modsw
Modulo Signed Word
modsw RT, RA, RB
Calculates remainder of signed word division.
Details
The 32-bit dividend is (RA)32:63. The 32-bit divisor is (RB)32:63. The 32-bit remainder of the dividend divided by the divisor is placed into RT32:63. The contents of RT0:31 are undefined.
Pseudocode Operation
dividend = (RA)32:63
divisor = (RB)32:63
if dividend >= 0 then
quotient = floor(dividend / divisor)
else
quotient = ceil(dividend / divisor)
RT32:63 <- dividend - (quotient * divisor)
RT0:31 <- undefined
Programming Note
If an attempt is made to perform any of the divisions 0x8000_0000 % -1 or
Example
modsw r3, r4, r5
Encoding
Binary Layout
31
0
RT
6
RA
11
RB
16
779
/
Operands
-
RT
Target -
RA
Dividend -
RB
Divisor