ROTR

Rotation to right

ROTR

ROTate Right


[Syntax]

ROTR src, dest

 

[Operation]

unsigned long tmp0, tmp1;

tmp0 = src & 31;

tmp1 = ( unsigned long ) dest >> tmp0;

dest = ( dest << ( 32 - tmp0 )) | tmp1;

 

[Function]

-

This instruction rotates dest rightward by the number of bit positions specified by src and saves the value in dest. Bits overflowing from the LSB are transferred to the MSB and to the C flag.

-

src is an unsigned integer in the range of 0 ? src ? 31.

-

When src is in register, only five bits in the LSB are valid.

 

[Instruction Format]

Syntax

Processng Size

src

dest

Code size

(Byte)

ROTR src, dest

L

#IMM:5

Rd

3

L

Rs

Rd

3

[Flag Change]

Flag

C

Z

S

O

Change

 

 

 

Conditions

C: After the operation, this flag will have the same MSB value as dest. In addition, when src is 0, this flag will have the same MSB value as dest.

Z: The flag is set if dest is 0 after the operation; otherwise it is cleared.

S: The flag is set if the MSB of dest after the operation is 1 ; otherwise it is cleared.

 

[Description Example]

ROTR #1, R1

ROTR R1, R2