SPARC Assembly/Multiplication and Division

Looking through the lists of instructions, it becomes clear that multiplication and division operations are not provided in SPARC: at least not in a form that most programmers are familiar with. This page is going to discuss the algorithms used to perform multiplication and division operations in SPARC

ExampleEdit


To multiply %13 and %14 and store in %15:

mov%13%00! First operand
mov%14%01! Second operand
call.mul! Result stored in %00
! To divide %13 by %14, use .div
! To find the modulus, use .rem
nop! Delay slot
mov%o0%15! Copy result to %15