nmacchws
Negative Multiply Accumulate Cross Halfword Signed
nmacchws RT, RA, RB
Negate product of cross halfwords and add to accumulator (Signed Saturation).
Encoding
Binary Layout
4
0:5
RT
6:10
RA
11:15
RB
16:20
238
21:30
0
31
Operands
-
RT
Acc/Dest -
RA
Src A -
RB
Src B
Example
nmacchws r3, r4, r5
Related
More in Embedded
Reference
Not in Power ISA v3.1C
Description
Not in Power ISA v3.1C: this is an embedded-core instruction, and the encoding shown is binutils' (opcodes/ppc-opc.c), not the manual's. Multiplies the sign-extended bottom halfword of RA by the sign-extended top halfword of RB, negates the product, and adds it to RT with signed saturation to 32 bits. The saturated result is stored in RT, and the SAT bit in the SPEFSCR is set if saturation occurred. This instruction requires the SPE category.
Operation
a ← EXTS(RA[16:31])
b ← EXTS(RB[0:15])
product ← (a × b)[32:63]
result ← RT + (¬product + 1)
if result > 2147483647 then
RT ← 2147483647
SPEFSCR[SAT] ← 1
elif result < -2147483648 then
RT ← -2147483648
SPEFSCR[SAT] ← 1
else
RT ← result