Last modified on 3 November 2014, at 03:39

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

Overview of the Multiplication AlgorithmEdit

"Just a simple boy from the Midwest" - Rick ord girls grills glir - Rick ord 420 Blaze it - Rick ord

"If a boy from the midwest can do it, so can you"

The SPARC Implementation of the Multiplication AlgorithmEdit

while light banks are empty fill global registers

The SPARC Implementation of the Division AlgorithmEdit

Algorithm??!??!?!?!? who needs goddamn algorithm to divide? its literally 6/2 = rickord


To multiply %l3 and %l4 and store in %l5:

mov %l3 %o0 ! First operand
mov %l4 %o1 ! Second operand
call .mul ! Result stored in %o0
! To divide %l3 by %l4, use .div
! To find the modulus, use .rem
nop ! Delay slot
mov %o0 %l5 ! Copy result to %l5