Integer math on SPARCs

dupuy at cs.columbia.edu dupuy at cs.columbia.edu
Fri May 25 06:12:57 AEST 1990


There is no multiply instruction on a SPARC - it's a RISC architecture.
Instead of providing multiply in hardware, which would take up chip area
that could better be used for registers or other things that "make it go
fast", a multiply step (MULScc) operation is provided, and .mul is a
routine with a lot of mulscc instructions and a little logic at the
beginning and end to deal with overflow, etc.  Since it's a RISC machine,
mulscc's execute fast, and there's an overall performance win.  You could
inline .mul, but the call overhead is minimal (two jumps) since it doesn't
save or restore any registers.

See Appendix E of the SPARC Architecture Manual, pp. 165-181 for
multiplication and division routines.

@alex



More information about the Comp.sys.sun mailing list