SPARC Assembly Language Reference Manual

Exit Print View

Updated: July 2014
 
 

1.3.9 Operators and Expressions

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

Table 1-3  Operators Recognized in Constant Expressions
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 Solaris Studio 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 Solaris Studio 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.