modsd

Modulo Signed Doubleword

modsd RT, RA, RB

Calculates remainder of signed doubleword division.

Details

The 64-bit dividend is (RA). The 64-bit divisor is (RB). The 64-bit remainder of the dividend divided by the divisor is placed into register RT. The quotient is not supplied as a result. Both operands and the remainder are interpreted as signed integers. The remainder is the unique signed integer that satisfies remainder = dividend - (quotient × divisor) where 0 ≤remainder < |divisor| if the dividend is nonnegative, and -|divisor| < remainder ≤0 if the dividend is negative.

Pseudocode Operation

dividend ← (RA)
divisor ← (RB)
RT ← dividend % divisor

Programming Note

If an attempt is made to perform any of the divisions % 0 or 0x8000_0000_0000_0000 % -1, then the contents of register RT are undefined.

Example

modsd r3, r4, r5

Encoding

Binary Layout
31
0
RT
6
RA
30
RB
31
777
/
 
Format X-form
Opcode 0x7C000612
Extension Base

Operands

  • RT
    Target
  • RA
    Dividend
  • RB
    Divisor