SHLR

Logical shift to the right

SHLR

SHift Logical Right


[Syntax]

(1)SHLR src, dest

(2)SHLR src, src2, dest

 

[Operation]

(1)dest = ( unsigned long ) dest >> ( src & 31 );

(2)dest = ( unsigned long ) src2 >> ( src & 31 );

 

[Function]

-

(1)This instruction logically shifts dest to the right by the number of bit positions specified by src and saves the value in dest.

-

Bits overflowing from the LSB are transferred 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.

-

(2)After this instruction transfers src2 to dest, it logically shifts dest to the right by the number of bit positions specified by src and saves the value in dest.

-

Bits overflowing from the LSB are transferred to the C flag.

-

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

 

[Instruction Format]

Syntax

Processng Size

src

src2

dest

Code size

(Byte)

(1)SHLR src, dest

L

#IMM:5

Rd

2

L

Rs

Rd

3

(1)SHLR src, src2, dest

L

#IMM:5

Rs

Rd

3

[Flag Change]

Flag

C

Z

S

O

Change

 

 

 

 

Conditions

C : The flag is set if the shifted-out bit is 1; otherwise it is cleared. However, when src is 0, this flag is also cleared.

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]

SHLR #3, R2

SHLR R1, R2

SHLR #3, R1, R2