SPARC Assembly Language Reference Manual

2.3.7 Special Symbols - Registers

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

Table 2–2

Symbol Object 



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 = %o6 = %r14)

Frame-pointer register 


(%fp = %i6 = %r30)

Floating-point registers 

%f0 … %f31


Floating-point status register 



Front of floating-point queue 



Coprocessor registers 

%c0 … %c31


Coprocessor status register 



Coprocessor queue 



Program status register 



Trap vector base address register 



Window invalid mask 



Y register 



Unary operators 


Extracts least significant 10 bits 



Extracts most significant 22 bits 



Used only in Sun compiler-generated code. 



Used only in Sun compiler-generated code. 

Ancillary state registers 

%asr1 … %asr31


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


is equivalent to


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