vshasigmaw

Vector SHA-256 Sigma Word

vshasigmaw vD, vA, ST, SIX

Performs the Sigma0/Sigma1/sigma0/sigma1 functions for SHA-256.

Details

The vshasigmaw instruction performs the SHA-256 sigma (σ0, σ1) or sigma-like (Σ0, Σ1) functions on each word element of a vector register. The operation is determined by the ST and SIX fields.

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
do i = 0 to 3
    src ← VSR[VRA+32].word[i]
    if ST=0 & SIX.bit[i]=0 then
        // SHA-256 σ0 function
        VSR[VRT+32].word[i] ← (src >>> 7) ⊕ (src >>> 18) ⊕ (src >> 3)
    if ST=0 & SIX.bit[i]=1 then
        // SHA-256 σ1 function
        VSR[VRT+32].word[i] ← (src >>> 17) ⊕ (src >>> 19) ⊕ (src >> 10)
    if ST=1 & SIX.bit[i]=0 then
        // SHA-256 Σ0 function
        VSR[VRT+32].word[i] ← (src >>> 2) ⊕ (src >>> 13) ⊕ (src >>> 22)
    if ST=1 & SIX.bit[i]=1 then
        // SHA-256 Σ1 function
        VSR[VRT+32].word[i] ← (src >>> 6) ⊕ (src >>> 11) ⊕ (src >>> 25)

Programming Note

The vshasigmaw instruction is used to perform SHA-256 sigma or sigma-like functions on vector register elements. Ensure that the Vector Facility is enabled by checking and setting the VEC bit in the MSR register. The instruction operates on each 32-bit word of the source vector, applying different bitwise rotations and XORs based on the ST and SIX fields. This instruction requires supervisor privilege level to execute.

Example

vshasigmaw v1, v2, 0, 0

Encoding

Binary Layout
4
0
VRT
6
VRA
11
ST
16
SIX
17
 
Format VX-form
Opcode 0x10000682
Extension Vector Crypto
Registers Altered MSR

Operands

  • vD
    Target
  • vA
    Source
  • ST
    Sigma Type (0/1)
  • SIX
    Shift Index (Immediate)
  • VRT
    Target Vector Register
  • VRA
    Source Vector Register