nmachhws

Negative Multiply Accumulate High Halfword Signed

nmachhws RT, RA, RB

Negate product of high halfwords and add to accumulator (Signed Saturation).

Details

Multiplies the high halfwords (bits 0–15) of RA and RB as signed 16-bit integers, negates the 32-bit product, and adds it to RT with signed saturation, storing the result in RT. This is an embedded SPE instruction that performs signed halfword multiply-accumulate with negation and saturation. The overflow and saturation bits (XER[OV] and XER[SAT]) are set appropriately.

Pseudocode Operation

prod ← EXTS((RA[0:15]) * (RB[0:15]))
result ← RT + (-prod)
if result > 2147483647 then
  RT ← 2147483647
  XER[SAT] ← 1
else if result < -2147483648 then
  RT ← -2147483648
  XER[SAT] ← 1
else
  RT ← result
XER[OV] ← XER[SAT]

Example

nmachhws r3, r4, r5

Encoding

Binary Layout
4
0
RT
6
RA
11
RB
16
110
21
0
31
 
Format XO-form
Opcode 0x100000DC
Extension Embedded

Operands

  • RT
    Acc/Dest
  • RA
    Src A
  • RB
    Src B