Divide the contents of a general purpose register by the contents of a general purpose register, storing the result into a general purpose register.
Bits | Value |
---|---|
0-5 | 31 |
6-10 | D |
11-15 | A |
16-20 | B |
21 | OE |
22-30 | 457 |
31 | Rc |
PowerPC | |
---|---|
divdu | RT, RA, RB (OE=0 Rc=0) |
divdu. | RT, RA, RB (OE=0 Rc=1) |
divduo | RT, RA, RB (OE=1 Rc=0) |
divduo. | RT, RA, RB (OE=1 Rc=1) |
The 64-bit dividend is the contents of RA. The 64-bit divisor is the contents of RB. The 64- bit quotient is placed into RT. The remainder is not supplied as a result.
Both the operands and the quotient are interpreted as unsigned integers, except that if the record bit (Rc) is set to 1 the first three bits of th condition register 0 (CR0) field are set by signed comparison of the result to zero. The quotient is the unique unsigned integer that satisfies the equation: dividend = (quotient * divisor) + r, where 0 <= r < divisor.
If an attempt is made to perform the division (anything) / 0 the contents of RT are undefined, as are the contents of the LT, GT, and EQ bits of the CR0 field (if Rc = 1). In this case, if the overflow enable bit (OE) = 1 then the overflow bit (OV) is set.
The 64-bit unsigned remainder of dividing (RA) by (RB) can be computed as follows:
divdu | RT,RA,RB | # RT = quotient |
mulld | RT,RT,RB | # RT = quotient * divisor |
subf | RT,RT,RA | # RT = remainder |
Other registers altered:
Affected: LT, GT, EQ, SO (if Rc = 1)
Note: The setting of the affected bits in the XER is mode-independent, and reflects overflow of the 64-bit result.
This instruction is defined only for 64-bit implementations. Using it on a 32-bit implementation will cause the system illegal instruction error handler to be invoked.