SPARC Assembly Language Reference Manual

Exit Print View

Updated: July 2014
 
 

6.4 Functions Returning Values

Functions that return an integer value return it in %o0 or %o0 and %o1. For 32-bit code, long long data are returned with the upper 32-bits in %o0 and the lower 32-bits in %o1, treating %o0 and %o1 as if they were 32-bit registers.

If the function returning a value has executed a save instruction, then the return value would normally be put into %i0 or %i1 just before executing a restore or return instruction, which changes register windows and puts the values into %o0 and %o1.

Functions that return a floating-point or complex value return it in some subset of %f0, %f1, %d0, %d2, %d4, and %d6. So a float value is returned in %f0, and a double value is returned in %d0 (or equivalently in %f0 and %f1).

Structure and array values returned by value are more complicated and beyond the scope of this manual. Registers %o0-%o5 and %f0-%f31 may be used as temporaries.