SPARC Assembly Language Reference Manual

2.3.8 Operators and Expressions

The operators described in Table 2–3 are recognized in constant expressions.

Table 2–3

Binary 

Operators 

Unary 

Operators 

Integer addition 

+

(No effect) 

– 

Integer subtraction 

2's Complement  

Integer multiplication 

~

1's Complement 

Integer division 

%lo(address)

Extract least significant 10 bits as computed by: (address & 0x3ff) 

Modulo 

%hi(address)

Extract most significant 22 bits as computed by: (address >>10) 

Exclusive OR

%r_disp32

%r_disp64

Used in Sun compiler-generated code only to instruct the assembler to generate specific relocation information for the given expression. 

<< 

Left shift 

%r_plt32

%r_plt64

Used in Sun compiler-generated code only to instruct the assembler to generate specific relocation information for the given expression. 

>> 

Right shift 

 

 

Bitwise AND

 

 

Bitwise OR

 

 

Since these operators have the same precedence as in the C language, put expressions in parentheses to avoid ambiguity.

To avoid confusion with register names or with the %hi, %lo, %r_disp32/64, or %r_plt32/64 operators, the modulo operator % must not be immediately followed by a letter or digit. The modulo operator is typically followed by a space or left parenthesis character.