xxbrw

Vector Byte-Reverse Word

xxbrw XT,XB

Reverses the bytes of each word in a vector register.

Details

The xxbrw instruction reverses the byte order of each word element in the source vector register and stores the result in the target vector register.

Pseudocode Operation

if MSR.VSX=0 then VSX_Unavailable()
do i = 0 to 3
    vsrc ←VSR[32×BX+B].word[i]
    do j = 0 to 3
        VSR[32×TX+T].word[i].byte[j] ←vsrc.byte[3-j]
    end
end

Programming Note

The xxbrw instruction is used to reverse the byte order of each word in a vector register. Ensure that VSX (Vector Scalar Extensions) is enabled by checking and setting the appropriate bit in the MSR register. This instruction operates on 128-bit vector registers, processing four 32-bit words per operation. Be cautious of alignment requirements; source and target vectors must be properly aligned to avoid exceptions.

Example

xxbrw vs1, vs3

Encoding

Binary Layout
T
6
B
11
BX
16
TX
21
 
Format XX2-form
Opcode 0xF00F076C
Extension VSX
Registers Altered MSR

Operands

  • XT
    Target Vector Register
  • XB
    Source Vector Register