EasyManua.ls Logo

Renesas SuperH SH-4A - EXTS (Extend as Signed): Arithmetic Instruction

Renesas SuperH SH-4A
472 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Rev. 1.50, 10/04, page 240 of 448
10.1.21 EXTS (Extend as Signed): Arithmetic Instruction
Format Operation Instruction Code Cycle T Bit
EXTS.B Rm,Rn Rm sign-extended from
byte Rn
0110nnnnmmmm1110 1
EXTS.W Rm,Rn Rm sign-extended from
word Rn
0110nnnnmmmm1111 1
Description:
This instruction sign-extends the contents of general register Rm and stores the result in Rn.
For a byte specification, the value of Rm bit 7 is transferred to Rn bits 8 to 31. For a word
specification, the value of Rm bit 15 is transferred to Rn bits 16 to 31.
Notes: None
Operation:
EXTSB(long m, long n) /* EXTS.B Rm,Rn */
{
R[n] = R[m];
if ((R[m] & 0x00000080)==0) R[n] & =0x000000FF;
else R[n] |= 0xFFFFFF00;
PC += 2;
}
EXTSW(long m, long n) /* EXTS.W Rm,Rn */
{
R[n] = R[m];
if ((R[m] & 0x00008000)==0) R[n] & =0x0000FFFF;
else R[n] |= 0xFFFF0000;
PC += 2;
}

Table of Contents

Related product manuals