vpmsumh

Vector Polynomial Multiply-Sum Halfword

vpmsumh vD, vA, vB

Performs GF(2) polynomial arithmetic on halfwords.

Details

The vpmsumh instruction performs a binary polynomial multiplication on corresponding halfword elements of two source vectors and then sums the results using exclusive-OR. This is useful for finite field arithmetic operations.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
do i = 0 to 7
   prod.bit[0:30] ←0
   srcA ←VSR[VRA+32].halfword[i]
   srcB ←VSR[VRB+32].halfword[i]
   do j = 0 to 15
      do k = 0 to j
         gbit ←srcA.bit[k] & srcB.bit[j-k]
         prod[i].bit[j] ←prod[i].bit[j] ⊕gbit
      end
      do k = j-15 to 15
         gbit ←(srcA.bit[k] & srcB.bit[j-k])
         prod[i].bit[j] ←prod[i].bit[j] ⊕gbit
      end
   end
end
do i = 0 to 3
   VSR[VRT+32].word[i] ←0b0 || (prod[2×i] ⊕prod[2×i+1])
end

Programming Note

The vpmsumh instruction is commonly used for finite field arithmetic operations, particularly in cryptographic algorithms. Ensure that the Vector Facility is enabled by checking and setting the VEC bit in the MSR register. Be cautious of alignment requirements; source vectors must be aligned to halfword boundaries. This instruction operates at a privilege level where vector operations are supported, typically user or supervisor mode. Exception conditions include a Vector Unavailable exception if the facility is not enabled.

Example

vpmsumh vd, va, vb

Encoding

Binary Layout
000100
0
vD
6
vA
11
vB
16
10001
21
001000
26
 
Format VX-form
Opcode 0x10000448
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B
  • VRT
    Target Vector Register
  • VRA
    Source Vector Register
  • VRB
    Source Vector Register