Assembler Reference

Shift operators

Shift operators act on numeric expressions, shifting or rotating the first operand by the amount specified by the second.

Table 3-7 shows the shift operators.

 

 

Table 3-7 Shift operators

 

 

 

Operator

Usage

Explanation

 

 

 

ROL

A:ROL:B

Rotate A left by B bits

 

 

 

ROR

A:ROR:B

Rotate A right by B bits

 

 

 

SHL

A:SHL:B

Shift A left by B bits

 

 

 

SHR

A:SHR:B

Shift A right by B bits

 

 

 

Note

SHR is a logical shift and does not propagate the sign bit.

Addition, subtraction, and logical operators

Addition and subtraction operators act on numeric expressions.

Logical operators act on numeric expressions. The operation is performed bitwise, that is, independently on each bit of the operands to produce the result.

Table 3-8 shows addition, subtraction, and logical operators.

 

 

Table 3-8 Addition, subtraction, and logical operators

 

 

 

Operator

Usage

Explanation

 

 

 

+

A+B

Add A to B

 

 

 

-

A-B

Subtract B from A

 

 

 

AND

A:AND:B

Bitwise AND of A and B

 

 

 

OR

A:OR:B

Bitwise OR of A and B

 

 

 

EOR

A:EOR:B

Bitwise Exclusive OR of A and B

 

 

 

ARM DUI 0068B

Copyright © 2000, 2001 ARM Limited. All rights reserved.

3-29

Page 107
Image 107
ARM VERSION 1.2 manual Shift operators, SHR is a logical shift and does not propagate the sign bit