SPARC Assembly Language Reference Manual

Exit Print View

Updated: July 2014
 
 

1.3.7 Special Symbols - Registers

Special symbol names begin with a percentage sign (%) to avoid conflict with user symbols. Table 1–2 lists these special symbol names.

Table 1-2  Special Symbol Names
Symbol Object
Name
Comment
General-purpose registers
%r0 … %r31
General-purpose global registers
%g0 … %g7
Same as %r0 … %r7
General-purpose out registers
%o0 … %o7
Same as %r8 … %r15
General-purpose local registers
%l0 … %l7
Same as %r16 … %r23
General-purpose in registers
%i0 … %i7
Same as %r24 … %r31
Stack-pointer register
%sp
(%sp = %o6 = %r14)
Frame-pointer register
%fp
(%fp = %i6 = %r30)
Floating-point registers
%f0 … %f31
Floating-point status register
%fsr
Front of floating-point queue
%fq
Program status register
%psr
Trap vector base address register
%tbr
Window invalid mask
%wim
Y register
%y
Unary operators
%lo
Extracts least significant 10 bits
%hi
Extracts most significant 22 bits
%r_disp32
Used only in Solaris Studio compiler-generated code.
%r_plt32
Used only in Solaris Studio compiler-generated code.
Ancillary state registers
%asr1 … %asr31

There is no case distinction in special symbols; for example,

%PSR 

is equivalent to

%psr 

The suggested style is to use lowercase letters.

The lack of case distinction allows for the use of non-recursive preprocessor substitutions, for example:

#define psr %PSR

The special symbols %hi and %lo are true unary operators which can be used in any expression and, as other unary operators, have higher precedence than binary operations. For example:

%hi a+b  =  (%hi a)+b
%lo a+b  =  (%lo a)+b

To avoid ambiguity, enclose operands of the %hi or %lo operators in parentheses. For example:

%hi(a) + b