vbrh

Vector Byte-Reverse Halfword

vbrh vD, vB

Reverses bytes within each halfword (Endian Swap).

Details

Reverses the order of bytes within each halfword (16-bit element) of the source vector, effectively performing a 16-bit endianness swap. The operation processes all 8 halfwords in the 128-bit vector independently. This instruction requires VMX/AltiVec support and does not affect any status registers.

Pseudocode Operation

for i = 0 to 7 do
  VR[vD][i*16:i*16+15] ← reverse_bytes(VR[vB][i*16:i*16+15])
end for

Example

vbrh vd, vb

Encoding

Binary Layout
4
0
vD
6
0
11
vB
16
1606
21
 
Format VX-form
Opcode 0x10000646
Extension VMX (AltiVec)

Operands

  • vD
    Target
  • vB
    Source