MUL MULTIPLY
Purpose |
perform arithmetic multiplication |
Format |
opcode mulr.rx, prod.mx 2 operand opcode mulr.rx, muld.rx, prod.wx 3 operand |
Operation |
prod ß prod * mulr; 2 operand prod ß muld * mulr; 3 operand |
Condition codes |
N ß prod LSS 0; Z ß prod EQL 0; V ß overflow; C ß 0; |
Exceptions |
Integer overflow Floating overflow Floating underflow Reserved operand |
Opcodes |
84 MULB2 Multiply Byte 2 Operand 85 MULB3 Multiply Byte 3 Operand A4 MULW2 Multiply Word 2 Operand A5 MULW3 Multiply Word 3 Operand C4 MULL2 Multiply Long 2 Operand C5 MULL3 Multiply Long 3 Operand 44 MUIF2 Multiply Floating 2 Operand 45 MULF3 Multiply Floating 3 Operand 64 MULD2 Multiply Double 2 Operand 65 MULD3 Multiply Double 3 Operand |
Description |
In 2 operand format, the product operand is multiplied by the multiplier operand and the product operand is replaced by the result. In 3 operand format, the multiplicand operand is multiplied by the multiplier operand and the product operand is replaced by the result. In floating format, the product operand result is rounded for both 2 and 3 operand format. |
Notes |
1. Integer overflow occurs if the high half of the double length result is not equal to the sign extension of the low half. On integer overflow, the product operand is replaced by the low order bits of the true result. 2. On a floating reserved operand fault, the product operand is unaffected and the condition codes are unpredictable. 3. On floating underflow, the product operand is replaced by 0. 4. On floating overflow, the product operand is replaced by an operand of all bits 0 except for a sign bit of 1 (a re served operand). Nß 1: Z ß 0; V ß 1; and C ß 0. |
Example 1
The program multiplies the values stored in R1 and R2 and put the result in R3.
.text
main: .word 0
movl $3, r1
movl $2, r2
mull3 r1, r2, r3
pushl r3
pushal format
calls $2, .printf
pushl $0
calls $1, .exit
.data
format: .asciz "R3 is %d"