MODS
Operation
Writes the signed remainder of destination-by-source truncation-toward-zero division.
Assembler Syntax
MODS.{B|W|L|Q}(z) <ea>(e), Rn(d)
MODS.{B|W|L|Q}(z) Rn(s), Rn(d)
Privilege
Unprivileged
Repeat eligibility
REP eligible; REPcc observes dst
Interprets both selected-width operands as signed integers and writes the remainder associated with truncation-toward-zero division. A sub-Q remainder is sign-extended to 64 bits. A zero divisor raises DIVIDE_BY_ZERO; the most-negative value divided by minus one raises SIGNED_DIVIDE_OVERFLOW.
Let \(n\) be the selected operand width, \(d\) the signed two's-complement dividend, and \(s\) the signed two's-complement divisor. The quotient and remainder are defined by $\(q = \operatorname{trunc}(d/s), \qquad r = d - qs .\)$ Thus a nonzero remainder has the sign of the dividend. The destination supplies the dividend and receives \(r\).
A zero divisor raises DIVIDE_BY_ZERO; the most-negative value divided by \(-1\) raises SIGNED_DIVIDE_OVERFLOW. No destination is changed.
2.75in
Encodings
MODS.{B|W|L|Q}(z) <ea>(e), Rn(d)
Format: Instruction format for MODS.{B|W|L|Q}(z) <ea>(e), Rn(d)
2.75in MODS.{B|W|L|Q}(z) Rn(s), Rn(d)
Format: Instruction format for MODS.{B|W|L|Q}(z) Rn(s), Rn(d)