Introduction
AltiVec (Apple called it Velocity Engine, IBM and the Power ISA call it VMX) adds 32 vector registers of 128 bits and instructions that work on 16 bytes, 8 halfwords or 4 words at a time. It appeared in the PowerPC 7400 (G4) and the 970 (G5), and is in the Cell PPE and in POWER6 and later. VSX, the vector-scalar facility of Power ISA 2.06 (POWER7), adds 64 registers that hold either a vector or a floating-point scalar, double-precision and single-precision vector arithmetic, and a second family of loads, stores and logical operations. Power ISA 2.07 (POWER8) and 3.0 (POWER9) added 64-bit integer elements, quadword arithmetic, AES, SHA and polynomial multiplication to the vector facility, and many VSX instructions. This page lists every AltiVec and VSX instruction the explorer decodes, including the vector and VSX loads and stores, which the explorer's links send here. The Gekko paired singles use some of the same opcodes and are on the Gekko page; a variant has one or the other.
The “Available in” column names the first level that has the instruction: AltiVec (G4, G5, Cell, POWER6 and later), VSX (POWER7 and later), ISA 2.07 (POWER8 and later), ISA 3.0 (POWER9 and later), ISA 3.1 (POWER10) and Cell only. An instruction marked ISA 2.07 or later also needs the vector or VSX facility.
Registers
- v0 to v31: the 32 vector registers, 128 bits each. They are the registers
vrt,vra,vrbandvrcof the tables below, five bits each. - VSCR: the vector status and control register, read with
mfvscrand written withmtvscr; see below. - VRSAVE: special-purpose register 256, a 32-bit mask the operating system and compilers use to record which vector registers a program is using. It has no effect on the hardware.
- vs0 to vs63 (VSX): 64 registers of 128 bits. A VSX instruction names a register with six bits: five in the
usual field and the sixth in a separate bit of the word (
xt,xa,xbandxcbelow). vs0 to vs31 overlay the floating-point registers f0 to f31, which are the high doubleword of each; vs32 to vs63 are the vector registers v0 to v31.
The vector registers hold elements in the order of the machine's byte order: element 0 is the one at the lowest address in big-endian mode, which the manuals and the tables use for the left-most element.
The VSCR
The vector status and control register has two bits that matter to a program: NJ (non-Java mode, which turns
on faster, less exact handling of denormal floating-point values) and SAT (saturation: a sticky bit that
any saturating instruction sets when a result was clamped). mfvscr and mtvscr move the register
through a vector register. SAT stays set until a program clears it with mtvscr.
Saturation
Most integer instructions come in two forms. The modulo form (vaddubm, vadduwm) wraps around
like ordinary integer arithmetic. The saturate form (vaddubs, vaddsws, the pack and
convert instructions that end in s) clamps a result that does not fit to the largest or smallest value of
the element, and sets VSCR[SAT]. A mnemonic names the element after the operation: b byte, h halfword,
w word, d doubleword, q quadword; u unsigned and s signed.
The instruction forms
The AltiVec instructions use primary opcode 4 and three forms (see instruction formats; bit 0 is the most significant bit):
| Form | Layout | Used for |
|---|---|---|
| VX | opcode 0-5, vrt 6-10, vra 11-15, vrb 16-20, extended opcode 21-31 | Two- and three-operand arithmetic, logic, merge, pack, shifts, splats. Some fields are an immediate instead of a register (uim, sim). |
| VA | opcode 0-5, vrt 6-10, vra 11-15, vrb 16-20, vrc 21-25, extended opcode 26-31 | Four-register instructions: multiply-add, select, permute. |
| VC | opcode 0-5, vrt 6-10, vra 11-15, vrb 16-20, Rc 21, extended opcode 22-31 | Compares. With the Rc bit set (the dotted mnemonic) the instruction also sets condition register field 6: bit 0 (LT) is set when every element compared true and bit 2 (EQ) when every element compared false. |
The VSX instructions use primary opcode 60 (and 61, 57, 56 and 62 for some loads and stores) with the XX forms: XX2 (one source
xb), XX3 (two sources xa, xb), XX4 (three sources, with xc) and for the
compares an XX3 form whose record bit is bit 21. The extra register bits are bit 29 (AX), 30 (BX), 31 (TX) and, in XX4, 28 (CX);
in the DQ form the TX bit is bit 28. The loads and stores of primary opcode 31 are in the X form.
Add and subtract
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vaddubm | vrt, vra, vrb | VX 4/0 | AltiVec | Add unsigned bytes, modulo. |
vadduhm | vrt, vra, vrb | VX 4/64 | AltiVec | Add unsigned halfwords, modulo. |
vadduwm | vrt, vra, vrb | VX 4/128 | AltiVec | Add unsigned words, modulo. |
vaddudm | vrt, vra, vrb | VX 4/192 | ISA 2.07 | Add unsigned doublewords, modulo. |
vadduqm | vrt, vra, vrb | VX 4/256 | ISA 2.07 | Add unsigned quadwords, modulo. |
vaddcuw | vrt, vra, vrb | VX 4/384 | AltiVec | Add and write the carry-out of each unsigned word. |
vaddcuq | vrt, vra, vrb | VX 4/320 | ISA 2.07 | Add and write the carry-out of the unsigned quadword. |
vaddubs | vrt, vra, vrb | VX 4/512 | AltiVec | Add unsigned bytes, saturate. |
vadduhs | vrt, vra, vrb | VX 4/576 | AltiVec | Add unsigned halfwords, saturate. |
vadduws | vrt, vra, vrb | VX 4/640 | AltiVec | Add unsigned words, saturate. |
vaddsbs | vrt, vra, vrb | VX 4/768 | AltiVec | Add signed bytes, saturate. |
vaddshs | vrt, vra, vrb | VX 4/832 | AltiVec | Add signed halfwords, saturate. |
vaddsws | vrt, vra, vrb | VX 4/896 | AltiVec | Add signed words, saturate. |
vsububm | vrt, vra, vrb | VX 4/1024 | AltiVec | Subtract unsigned bytes, modulo. |
vsubuhm | vrt, vra, vrb | VX 4/1088 | AltiVec | Subtract unsigned halfwords, modulo. |
vsubuwm | vrt, vra, vrb | VX 4/1152 | AltiVec | Subtract unsigned words, modulo. |
vsubudm | vrt, vra, vrb | VX 4/1216 | ISA 2.07 | Subtract unsigned doublewords, modulo. |
vsubuqm | vrt, vra, vrb | VX 4/1280 | ISA 2.07 | Subtract unsigned quadwords, modulo. |
vsubcuw | vrt, vra, vrb | VX 4/1408 | AltiVec | Subtract and write the carry-out of each unsigned word. |
vsubcuq | vrt, vra, vrb | VX 4/1344 | ISA 2.07 | Subtract and write the carry-out of the unsigned quadword. |
vsububs | vrt, vra, vrb | VX 4/1536 | AltiVec | Subtract unsigned bytes, saturate. |
vsubuhs | vrt, vra, vrb | VX 4/1600 | AltiVec | Subtract unsigned halfwords, saturate. |
vsubuws | vrt, vra, vrb | VX 4/1664 | AltiVec | Subtract unsigned words, saturate. |
vsubsbs | vrt, vra, vrb | VX 4/1792 | AltiVec | Subtract signed bytes, saturate. |
vsubshs | vrt, vra, vrb | VX 4/1856 | AltiVec | Subtract signed halfwords, saturate. |
vsubsws | vrt, vra, vrb | VX 4/1920 | AltiVec | Subtract signed words, saturate. |
vaddeuqm | vrt, vra, vrb, vrc | VA 4/60 | ISA 2.07 | Add extended (with the carry in the low bit of vrc) unsigned quadwords, modulo. |
vaddecuq | vrt, vra, vrb, vrc | VA 4/61 | ISA 2.07 | Add extended and write the carry-out of the unsigned quadword. |
vsubeuqm | vrt, vra, vrb, vrc | VA 4/62 | ISA 2.07 | Subtract extended unsigned quadwords, modulo. |
vsubecuq | vrt, vra, vrb, vrc | VA 4/63 | ISA 2.07 | Subtract extended and write the carry-out of the unsigned quadword. |
Maximum, minimum and average
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vmaxub | vrt, vra, vrb | VX 4/2 | AltiVec | Maximum of unsigned bytes. |
vmaxuh | vrt, vra, vrb | VX 4/66 | AltiVec | Maximum of unsigned halfwords. |
vmaxuw | vrt, vra, vrb | VX 4/130 | AltiVec | Maximum of unsigned words. |
vmaxud | vrt, vra, vrb | VX 4/194 | ISA 2.07 | Maximum of unsigned doublewords. |
vmaxsb | vrt, vra, vrb | VX 4/258 | AltiVec | Maximum of signed bytes. |
vmaxsh | vrt, vra, vrb | VX 4/322 | AltiVec | Maximum of signed halfwords. |
vmaxsw | vrt, vra, vrb | VX 4/386 | AltiVec | Maximum of signed words. |
vmaxsd | vrt, vra, vrb | VX 4/450 | ISA 2.07 | Maximum of signed doublewords. |
vminub | vrt, vra, vrb | VX 4/514 | AltiVec | Minimum of unsigned bytes. |
vminuh | vrt, vra, vrb | VX 4/578 | AltiVec | Minimum of unsigned halfwords. |
vminuw | vrt, vra, vrb | VX 4/642 | AltiVec | Minimum of unsigned words. |
vminud | vrt, vra, vrb | VX 4/706 | ISA 2.07 | Minimum of unsigned doublewords. |
vminsb | vrt, vra, vrb | VX 4/770 | AltiVec | Minimum of signed bytes. |
vminsh | vrt, vra, vrb | VX 4/834 | AltiVec | Minimum of signed halfwords. |
vminsw | vrt, vra, vrb | VX 4/898 | AltiVec | Minimum of signed words. |
vminsd | vrt, vra, vrb | VX 4/962 | ISA 2.07 | Minimum of signed doublewords. |
vavgub | vrt, vra, vrb | VX 4/1026 | AltiVec | Average of unsigned bytes. |
vavguh | vrt, vra, vrb | VX 4/1090 | AltiVec | Average of unsigned halfwords. |
vavguw | vrt, vra, vrb | VX 4/1154 | AltiVec | Average of unsigned words. |
vavgsb | vrt, vra, vrb | VX 4/1282 | AltiVec | Average of signed bytes. |
vavgsh | vrt, vra, vrb | VX 4/1346 | AltiVec | Average of signed halfwords. |
vavgsw | vrt, vra, vrb | VX 4/1410 | AltiVec | Average of signed words. |
Shift and rotate
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vrlb | vrt, vra, vrb | VX 4/4 | AltiVec | Rotate bytes left. |
vrlh | vrt, vra, vrb | VX 4/68 | AltiVec | Rotate halfwords left. |
vrlw | vrt, vra, vrb | VX 4/132 | AltiVec | Rotate words left. |
vrld | vrt, vra, vrb | VX 4/196 | ISA 2.07 | Rotate doublewords left. |
vslb | vrt, vra, vrb | VX 4/260 | AltiVec | Shift bytes left. |
vslh | vrt, vra, vrb | VX 4/324 | AltiVec | Shift halfwords left. |
vslw | vrt, vra, vrb | VX 4/388 | AltiVec | Shift words left. |
vsl | vrt, vra, vrb | VX 4/452 | AltiVec | Shift the whole vector left by bits (0 to 7). |
vsrb | vrt, vra, vrb | VX 4/516 | AltiVec | Shift bytes right. |
vsrh | vrt, vra, vrb | VX 4/580 | AltiVec | Shift halfwords right. |
vsrw | vrt, vra, vrb | VX 4/644 | AltiVec | Shift words right. |
vsr | vrt, vra, vrb | VX 4/708 | AltiVec | Shift the whole vector right by bits (0 to 7). |
vsrab | vrt, vra, vrb | VX 4/772 | AltiVec | Shift bytes right algebraic. |
vsrah | vrt, vra, vrb | VX 4/836 | AltiVec | Shift halfwords right algebraic. |
vsraw | vrt, vra, vrb | VX 4/900 | AltiVec | Shift words right algebraic. |
vsrad | vrt, vra, vrb | VX 4/964 | ISA 2.07 | Shift doublewords right algebraic. |
vsld | vrt, vra, vrb | VX 4/1476 | ISA 2.07 | Shift doublewords left. |
vsrd | vrt, vra, vrb | VX 4/1732 | ISA 2.07 | Shift doublewords right. |
vslo | vrt, vra, vrb | VX 4/1036 | AltiVec | Shift the whole vector left by octets (bytes). |
vsro | vrt, vra, vrb | VX 4/1100 | AltiVec | Shift the whole vector right by octets (bytes). |
Logical
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vand | vrt, vra, vrb | VX 4/1028 | AltiVec | Logical AND. |
vandc | vrt, vra, vrb | VX 4/1092 | AltiVec | Logical AND with complement. |
vor | vrt, vra, vrb | VX 4/1156 | AltiVec | Logical OR. |
vxor | vrt, vra, vrb | VX 4/1220 | AltiVec | Logical XOR. |
vnor | vrt, vra, vrb | VX 4/1284 | AltiVec | Logical NOR. |
vorc | vrt, vra, vrb | VX 4/1348 | ISA 2.07 | Logical OR with complement. |
vnand | vrt, vra, vrb | VX 4/1412 | ISA 2.07 | Logical NAND. |
veqv | vrt, vra, vrb | VX 4/1668 | ISA 2.07 | Logical equivalent (XNOR). |
Multiply and sum across
The odd and even multiplies take every second element and produce elements twice as wide. The sum-across instructions add groups of elements into words. The multiply-sum and multiply-add instructions are in the four-register section below.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vmuloub | vrt, vra, vrb | VX 4/8 | AltiVec | Multiply odd unsigned bytes. |
vmulouh | vrt, vra, vrb | VX 4/72 | AltiVec | Multiply odd unsigned halfwords. |
vmulouw | vrt, vra, vrb | VX 4/136 | ISA 2.07 | Multiply odd unsigned words. |
vmulosb | vrt, vra, vrb | VX 4/264 | AltiVec | Multiply odd signed bytes. |
vmulosh | vrt, vra, vrb | VX 4/328 | AltiVec | Multiply odd signed halfwords. |
vmulosw | vrt, vra, vrb | VX 4/392 | ISA 2.07 | Multiply odd signed words. |
vmuleub | vrt, vra, vrb | VX 4/520 | AltiVec | Multiply even unsigned bytes. |
vmuleuh | vrt, vra, vrb | VX 4/584 | AltiVec | Multiply even unsigned halfwords. |
vmuleuw | vrt, vra, vrb | VX 4/648 | ISA 2.07 | Multiply even unsigned words. |
vmulesb | vrt, vra, vrb | VX 4/776 | AltiVec | Multiply even signed bytes. |
vmulesh | vrt, vra, vrb | VX 4/840 | AltiVec | Multiply even signed halfwords. |
vmulesw | vrt, vra, vrb | VX 4/904 | ISA 2.07 | Multiply even signed words. |
vmuluwm | vrt, vra, vrb | VX 4/137 | ISA 2.07 | Multiply unsigned words, modulo (low half of each product). |
vsum4ubs | vrt, vra, vrb | VX 4/1544 | AltiVec | Sum each group of four unsigned bytes of vra with a word of vrb, saturate. |
vsum4sbs | vrt, vra, vrb | VX 4/1800 | AltiVec | Sum each group of four signed bytes of vra with a word of vrb, saturate. |
vsum4shs | vrt, vra, vrb | VX 4/1608 | AltiVec | Sum each pair of signed halfwords of vra with a word of vrb, saturate. |
vsum2sws | vrt, vra, vrb | VX 4/1672 | AltiVec | Sum across partial (half) signed words, saturate. |
vsumsws | vrt, vra, vrb | VX 4/1928 | AltiVec | Sum across all four signed words, saturate. |
Merge and pack
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vmrghb | vrt, vra, vrb | VX 4/12 | AltiVec | Merge the high bytes of vra and vrb. |
vmrghh | vrt, vra, vrb | VX 4/76 | AltiVec | Merge the high halfwords. |
vmrghw | vrt, vra, vrb | VX 4/140 | AltiVec | Merge the high words. |
vmrglb | vrt, vra, vrb | VX 4/268 | AltiVec | Merge the low bytes. |
vmrglh | vrt, vra, vrb | VX 4/332 | AltiVec | Merge the low halfwords. |
vmrglw | vrt, vra, vrb | VX 4/396 | AltiVec | Merge the low words. |
vmrgew | vrt, vra, vrb | VX 4/1932 | ISA 2.07 | Merge the even words. |
vmrgow | vrt, vra, vrb | VX 4/1676 | ISA 2.07 | Merge the odd words. |
vpkuhum | vrt, vra, vrb | VX 4/14 | AltiVec | Pack unsigned halfwords to unsigned bytes, modulo. |
vpkuwum | vrt, vra, vrb | VX 4/78 | AltiVec | Pack unsigned words to unsigned halfwords, modulo. |
vpkuhus | vrt, vra, vrb | VX 4/142 | AltiVec | Pack unsigned halfwords to unsigned bytes, saturate. |
vpkuwus | vrt, vra, vrb | VX 4/206 | AltiVec | Pack unsigned words to unsigned halfwords, saturate. |
vpkshus | vrt, vra, vrb | VX 4/270 | AltiVec | Pack signed halfwords to unsigned bytes, saturate. |
vpkswus | vrt, vra, vrb | VX 4/334 | AltiVec | Pack signed words to unsigned halfwords, saturate. |
vpkshss | vrt, vra, vrb | VX 4/398 | AltiVec | Pack signed halfwords to signed bytes, saturate. |
vpkswss | vrt, vra, vrb | VX 4/462 | AltiVec | Pack signed words to signed halfwords, saturate. |
vpkpx | vrt, vra, vrb | VX 4/782 | AltiVec | Pack 32-bit pixels to 16-bit pixels. |
vpkudum | vrt, vra, vrb | VX 4/1102 | ISA 2.07 | Pack unsigned doublewords to unsigned words, modulo. |
vpkudus | vrt, vra, vrb | VX 4/1230 | ISA 2.07 | Pack unsigned doublewords to unsigned words, saturate. |
vpksdus | vrt, vra, vrb | VX 4/1358 | ISA 2.07 | Pack signed doublewords to unsigned words, saturate. |
vpksdss | vrt, vra, vrb | VX 4/1486 | ISA 2.07 | Pack signed doublewords to signed words, saturate. |
Unpack, estimate, round, count and gather
These take one source register (vrb); the vra field of the encoding is not used.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vupkhsb | vrt, vrb | VX 4/526 | AltiVec | Unpack the high signed bytes to halfwords. |
vupkhsh | vrt, vrb | VX 4/590 | AltiVec | Unpack the high signed halfwords to words. |
vupklsb | vrt, vrb | VX 4/654 | AltiVec | Unpack the low signed bytes to halfwords. |
vupklsh | vrt, vrb | VX 4/718 | AltiVec | Unpack the low signed halfwords to words. |
vupkhpx | vrt, vrb | VX 4/846 | AltiVec | Unpack the high 16-bit pixels to 32-bit pixels. |
vupklpx | vrt, vrb | VX 4/974 | AltiVec | Unpack the low 16-bit pixels to 32-bit pixels. |
vupkhsw | vrt, vrb | VX 4/1614 | ISA 2.07 | Unpack the high signed words to doublewords. |
vupklsw | vrt, vrb | VX 4/1742 | ISA 2.07 | Unpack the low signed words to doublewords. |
vrefp | vrt, vrb | VX 4/266 | AltiVec | Reciprocal estimate, floating-point. |
vrsqrtefp | vrt, vrb | VX 4/330 | AltiVec | Reciprocal square root estimate, floating-point. |
vexptefp | vrt, vrb | VX 4/394 | AltiVec | 2 raised to the exponent, estimate, floating-point. |
vlogefp | vrt, vrb | VX 4/458 | AltiVec | Logarithm base 2, estimate, floating-point. |
vrfin | vrt, vrb | VX 4/522 | AltiVec | Round to the nearest floating-point integer. |
vrfiz | vrt, vrb | VX 4/586 | AltiVec | Round to a floating-point integer toward zero. |
vrfip | vrt, vrb | VX 4/650 | AltiVec | Round to a floating-point integer toward +infinity. |
vrfim | vrt, vrb | VX 4/714 | AltiVec | Round to a floating-point integer toward -infinity. |
vclzb | vrt, vrb | VX 4/1794 | ISA 2.07 | Count leading zeros in each byte. |
vclzh | vrt, vrb | VX 4/1858 | ISA 2.07 | Count leading zeros in each halfword. |
vclzw | vrt, vrb | VX 4/1922 | ISA 2.07 | Count leading zeros in each word. |
vclzd | vrt, vrb | VX 4/1986 | ISA 2.07 | Count leading zeros in each doubleword. |
vpopcntb | vrt, vrb | VX 4/1795 | ISA 2.07 | Population count of each byte. |
vpopcnth | vrt, vrb | VX 4/1859 | ISA 2.07 | Population count of each halfword. |
vpopcntw | vrt, vrb | VX 4/1923 | ISA 2.07 | Population count of each word. |
vpopcntd | vrt, vrb | VX 4/1987 | ISA 2.07 | Population count of each doubleword. |
vgbbd | vrt, vrb | VX 4/1292 | ISA 2.07 | Gather bits by bytes by doubleword (transposes the 8 by 8 bit matrix of each doubleword). |
Floating-point
AltiVec floating-point works on four single-precision values. There is no vector floating-point multiply: use
vmaddfp with a zero addend. Floating-point comparisons are in the compare section and
conversions in the conversion section.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vaddfp | vrt, vra, vrb | VX 4/10 | AltiVec | Add floating-point. |
vsubfp | vrt, vra, vrb | VX 4/74 | AltiVec | Subtract floating-point. |
vmaxfp | vrt, vra, vrb | VX 4/1034 | AltiVec | Maximum floating-point. |
vminfp | vrt, vra, vrb | VX 4/1098 | AltiVec | Minimum floating-point. |
vmaddfp | vrt, vra, vrc, vrb | VA 4/46 | AltiVec | Multiply-add floating-point: vra × vrc + vrb. |
vnmsubfp | vrt, vra, vrc, vrb | VA 4/47 | AltiVec | Negative multiply-subtract floating-point: -(vra × vrc - vrb). |
Conversion between integer and floating-point
The last operand is a 5-bit scale: the integer is divided or multiplied by 2 to the power of that number.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vcfux | vrt, vrb, uim5 | VX 4/778 | AltiVec | Convert from unsigned fixed-point words to floating-point. |
vcfsx | vrt, vrb, uim5 | VX 4/842 | AltiVec | Convert from signed fixed-point words to floating-point. |
vctuxs | vrt, vrb, uim5 | VX 4/906 | AltiVec | Convert to unsigned fixed-point words, saturate. |
vctsxs | vrt, vrb, uim5 | VX 4/970 | AltiVec | Convert to signed fixed-point words, saturate. |
Splat and the status register
A splat copies one element, or an immediate, to every element of the result. The element number is 4, 3 or 2 bits wide (16 bytes, 8 halfwords, 4 words); the remaining bits of the field must be zero.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vspltb | vrt, vrb, uim4 | VX 4/524 | AltiVec | Splat byte UIM of vrb to every byte. |
vsplth | vrt, vrb, uim3 | VX 4/588 | AltiVec | Splat halfword UIM of vrb to every halfword. |
vspltw | vrt, vrb, uim2 | VX 4/652 | AltiVec | Splat word UIM of vrb to every word. |
vspltisb | vrt, sim5 | VX 4/780 | AltiVec | Splat the signed 5-bit immediate, sign-extended, to every byte. |
vspltish | vrt, sim5 | VX 4/844 | AltiVec | Splat the signed 5-bit immediate to every halfword. |
vspltisw | vrt, sim5 | VX 4/908 | AltiVec | Splat the signed 5-bit immediate to every word. |
mfvscr | vrt | VX 4/1540 | AltiVec | Move from the vector status and control register. |
mtvscr | vrb | VX 4/1604 | AltiVec | Move to the vector status and control register. |
Four-register instructions: permute, select, multiply-add
The VA form names a fourth register. vperm is the general byte shuffle: each byte of vrc picks one of the
32 bytes of vra and vrb (the low five bits of the byte). vsel takes each bit from
vrb where the bit of vrc is 1 and from vra where it is 0.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vsel | vrt, vra, vrb, vrc | VA 4/42 | AltiVec | Select: bits of vrb where vrc is 1, else vra. |
vperm | vrt, vra, vrb, vrc | VA 4/43 | AltiVec | Permute the bytes of vra and vrb by vrc. |
vpermxor | vrt, vra, vrb, vrc | VA 4/45 | ISA 2.07 | Permute and exclusive-OR. |
vpermr | vrt, vra, vrb, vrc | VA 4/59 | ISA 3.0 | Permute with right-indexed (reversed) byte numbering. |
vsldoi | vrt, vra, vrb, vsh | VA 4/44 (bit 21 zero, 4-bit SHB field) | AltiVec | Shift left double by octet immediate: bytes SHB to SHB+15 of vra followed by vrb. |
vmhaddshs | vrt, vra, vrb, vrc | VA 4/32 | AltiVec | Multiply-high and add signed halfwords, saturate. |
vmhraddshs | vrt, vra, vrb, vrc | VA 4/33 | AltiVec | Multiply-high, round and add signed halfwords, saturate. |
vmladduhm | vrt, vra, vrb, vrc | VA 4/34 | AltiVec | Multiply-low and add unsigned halfwords, modulo. |
vmsumudm | vrt, vra, vrb, vrc | VA 4/35 | ISA 3.0 | Multiply-sum unsigned doublewords, modulo. |
vmsumubm | vrt, vra, vrb, vrc | VA 4/36 | AltiVec | Multiply-sum unsigned bytes, modulo. |
vmsummbm | vrt, vra, vrb, vrc | VA 4/37 | AltiVec | Multiply-sum mixed (signed by unsigned) bytes, modulo. |
vmsumuhm | vrt, vra, vrb, vrc | VA 4/38 | AltiVec | Multiply-sum unsigned halfwords, modulo. |
vmsumuhs | vrt, vra, vrb, vrc | VA 4/39 | AltiVec | Multiply-sum unsigned halfwords, saturate. |
vmsumshm | vrt, vra, vrb, vrc | VA 4/40 | AltiVec | Multiply-sum signed halfwords, modulo. |
vmsumshs | vrt, vra, vrb, vrc | VA 4/41 | AltiVec | Multiply-sum signed halfwords, saturate. |
vmsumcud | vrt, vra, vrb, vrc | VA 4/23 | ISA 3.1 | Multiply-sum and write the carry-out of unsigned doublewords. |
Compare
A vector compare writes all ones into each element where the relation holds and all zeros elsewhere. The dotted form
(the VC form with Rc set) also sets condition register field 6, so a program can branch on
“all elements” or “no element” without moving the result. vcmpbfp tests whether each value is within the bounds
given by the other register; its result bits are not all ones or all zeros.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vcmpequb, vcmpequb. | vrt, vra, vrb | VC 4/6 | AltiVec | Compare equal, unsigned bytes. |
vcmpequh, vcmpequh. | vrt, vra, vrb | VC 4/70 | AltiVec | Compare equal, unsigned halfwords. |
vcmpequw, vcmpequw. | vrt, vra, vrb | VC 4/134 | AltiVec | Compare equal, unsigned words. |
vcmpequd, vcmpequd. | vrt, vra, vrb | VC 4/199 | ISA 2.07 | Compare equal, unsigned doublewords. |
vcmpgtub, vcmpgtub. | vrt, vra, vrb | VC 4/518 | AltiVec | Compare greater than, unsigned bytes. |
vcmpgtuh, vcmpgtuh. | vrt, vra, vrb | VC 4/582 | AltiVec | Compare greater than, unsigned halfwords. |
vcmpgtuw, vcmpgtuw. | vrt, vra, vrb | VC 4/646 | AltiVec | Compare greater than, unsigned words. |
vcmpgtud, vcmpgtud. | vrt, vra, vrb | VC 4/711 | ISA 2.07 | Compare greater than, unsigned doublewords. |
vcmpgtsb, vcmpgtsb. | vrt, vra, vrb | VC 4/774 | AltiVec | Compare greater than, signed bytes. |
vcmpgtsh, vcmpgtsh. | vrt, vra, vrb | VC 4/838 | AltiVec | Compare greater than, signed halfwords. |
vcmpgtsw, vcmpgtsw. | vrt, vra, vrb | VC 4/902 | AltiVec | Compare greater than, signed words. |
vcmpgtsd, vcmpgtsd. | vrt, vra, vrb | VC 4/967 | ISA 2.07 | Compare greater than, signed doublewords. |
vcmpeqfp, vcmpeqfp. | vrt, vra, vrb | VC 4/198 | AltiVec | Compare equal, floating-point. |
vcmpgefp, vcmpgefp. | vrt, vra, vrb | VC 4/454 | AltiVec | Compare greater than or equal, floating-point. |
vcmpgtfp, vcmpgtfp. | vrt, vra, vrb | VC 4/710 | AltiVec | Compare greater than, floating-point. |
vcmpbfp, vcmpbfp. | vrt, vra, vrb | VC 4/966 | AltiVec | Compare bounds, floating-point. |
vcmpneb, vcmpneb. | vrt, vra, vrb | VC 4/7 | ISA 3.0 | Compare not equal, bytes. |
vcmpneh, vcmpneh. | vrt, vra, vrb | VC 4/71 | ISA 3.0 | Compare not equal, halfwords. |
vcmpnew, vcmpnew. | vrt, vra, vrb | VC 4/135 | ISA 3.0 | Compare not equal, words. |
vcmpnezb, vcmpnezb. | vrt, vra, vrb | VC 4/263 | ISA 3.0 | Compare not equal or zero, bytes. |
vcmpnezh, vcmpnezh. | vrt, vra, vrb | VC 4/327 | ISA 3.0 | Compare not equal or zero, halfwords. |
vcmpnezw, vcmpnezw. | vrt, vra, vrb | VC 4/391 | ISA 3.0 | Compare not equal or zero, words. |
AES, SHA, polynomial multiply and bit permute
Power ISA 2.07 added instructions for the AES rounds (the cipher and inverse cipher steps and the S-box), the SHA-256 and SHA-512 sigma functions, carry-less (polynomial) multiplication for CRC and GCM, and a bit permute.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
vbpermq | vrt, vra, vrb | VX 4/1356 | ISA 2.07 | Bit permute quadword. |
vcipher | vrt, vra, vrb | VX 4/1288 | ISA 2.07 | AES cipher round. |
vcipherlast | vrt, vra, vrb | VX 4/1289 | ISA 2.07 | AES cipher, last round. |
vncipher | vrt, vra, vrb | VX 4/1352 | ISA 2.07 | AES inverse cipher round. |
vncipherlast | vrt, vra, vrb | VX 4/1353 | ISA 2.07 | AES inverse cipher, last round. |
vsbox | vrt, vra | VX 4/1480 | ISA 2.07 | AES S-box. |
vpmsumb | vrt, vra, vrb | VX 4/1032 | ISA 2.07 | Polynomial multiply-sum, bytes. |
vpmsumh | vrt, vra, vrb | VX 4/1096 | ISA 2.07 | Polynomial multiply-sum, halfwords. |
vpmsumw | vrt, vra, vrb | VX 4/1160 | ISA 2.07 | Polynomial multiply-sum, words. |
vpmsumd | vrt, vra, vrb | VX 4/1224 | ISA 2.07 | Polynomial multiply-sum, doublewords. |
vshasigmad | vrt, vra, st, six | VX 4/1730 (ST bit 16, SIX bits 17-20) | ISA 2.07 | SHA-512 sigma functions on doublewords. |
vshasigmaw | vrt, vra, st, six | VX 4/1666 (ST bit 16, SIX bits 17-20) | ISA 2.07 | SHA-256 sigma functions on words. |
AltiVec loads and stores
All use the X form with an indexed address (ra|0) + rb. lvx and stvx ignore the low
four bits of the address, so they are always 16-byte aligned; to read an unaligned vector, a program uses lvsl or
lvsr to build a permute control vector and combines two aligned loads with vperm. The element
loads and stores move one byte, halfword or word to or from the position the address selects. The l suffix
(“last”) hints that the data will not be used again soon. The four dst forms start a prefetch stream;
dss stops one.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
lvebx | vrt, ra0, rb | X 31/7 | AltiVec | Load vector element byte indexed. |
lvehx | vrt, ra0, rb | X 31/39 | AltiVec | Load vector element halfword indexed. |
lvewx | vrt, ra0, rb | X 31/71 | AltiVec | Load vector element word indexed. |
lvx | vrt, ra0, rb | X 31/103 | AltiVec | Load vector indexed (16-byte aligned). |
lvxl | vrt, ra0, rb | X 31/359 | AltiVec | Load vector indexed last (the data is not reused soon). |
lvsl | vrt, ra0, rb | X 31/6 | AltiVec | Load vector for shift left: a permute control for an unaligned load. |
lvsr | vrt, ra0, rb | X 31/38 | AltiVec | Load vector for shift right. |
stvebx | vrs, ra0, rb | X 31/135 | AltiVec | Store vector element byte indexed. |
stvehx | vrs, ra0, rb | X 31/167 | AltiVec | Store vector element halfword indexed. |
stvewx | vrs, ra0, rb | X 31/199 | AltiVec | Store vector element word indexed. |
stvx | vrs, ra0, rb | X 31/231 | AltiVec | Store vector indexed (16-byte aligned). |
stvxl | vrs, ra0, rb | X 31/487 | AltiVec | Store vector indexed last. |
lvlx | vrt, ra0, rb | X 31/519 | Cell only | Load vector left indexed. |
lvlxl | vrt, ra0, rb | X 31/775 | Cell only | Load vector left indexed last. |
lvrx | vrt, ra0, rb | X 31/551 | Cell only | Load vector right indexed. |
lvrxl | vrt, ra0, rb | X 31/807 | Cell only | Load vector right indexed last. |
stvlx | vrs, ra0, rb | X 31/647 | Cell only | Store vector left indexed. |
stvlxl | vrs, ra0, rb | X 31/903 | Cell only | Store vector left indexed last. |
stvrx | vrs, ra0, rb | X 31/679 | Cell only | Store vector right indexed. |
stvrxl | vrs, ra0, rb | X 31/935 | Cell only | Store vector right indexed last. |
dst | ra0, rb, strm | X 31/342 (T = 0) | AltiVec | Data stream touch. |
dstt | ra0, rb, strm | X 31/342 (T = 1) | AltiVec | Data stream touch, transient. |
dstst | ra0, rb, strm | X 31/374 (T = 0) | AltiVec | Data stream touch for store. |
dststt | ra0, rb, strm | X 31/374 (T = 1) | AltiVec | Data stream touch for store, transient. |
dss | strm | X 31/822 (A = 0) | AltiVec | Data stream stop. |
dssall | (none) | X 31/822 (A = 1) | AltiVec | Data stream stop all. |
VSX scalar arithmetic
The scalar instructions work on the first doubleword of a VSX register (single-precision ones on a value in the double-precision
register format). The multiply-add forms come in two types: type A overwrites the addend register, type M overwrites the
multiplicand. Operands are xt, xa, xb.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
xsadddp | xt, xa, xb | XX3 60/32 | VSX | Scalar add, double-precision. |
xsaddsp | xt, xa, xb | XX3 60/0 | ISA 2.07 | Scalar add, single-precision. |
xssubdp | xt, xa, xb | XX3 60/40 | VSX | Scalar subtract, double-precision. |
xssubsp | xt, xa, xb | XX3 60/8 | ISA 2.07 | Scalar subtract, single-precision. |
xsmuldp | xt, xa, xb | XX3 60/48 | VSX | Scalar multiply, double-precision. |
xsmulsp | xt, xa, xb | XX3 60/16 | ISA 2.07 | Scalar multiply, single-precision. |
xsdivdp | xt, xa, xb | XX3 60/56 | VSX | Scalar divide, double-precision. |
xsdivsp | xt, xa, xb | XX3 60/24 | ISA 2.07 | Scalar divide, single-precision. |
xsmaddadp | xt, xa, xb | XX3 60/33 | VSX | Scalar multiply-add type-A, double-precision. |
xsmaddmdp | xt, xa, xb | XX3 60/41 | VSX | Scalar multiply-add type-M, double-precision. |
xsmsubadp | xt, xa, xb | XX3 60/49 | VSX | Scalar multiply-subtract type-A, double-precision. |
xsmsubmdp | xt, xa, xb | XX3 60/57 | VSX | Scalar multiply-subtract type-M, double-precision. |
xsnmaddadp | xt, xa, xb | XX3 60/161 | VSX | Scalar negative multiply-add type-A, double-precision. |
xsnmaddmdp | xt, xa, xb | XX3 60/169 | VSX | Scalar negative multiply-add type-M, double-precision. |
xsnmsubadp | xt, xa, xb | XX3 60/177 | VSX | Scalar negative multiply-subtract type-A, double-precision. |
xsnmsubmdp | xt, xa, xb | XX3 60/185 | VSX | Scalar negative multiply-subtract type-M, double-precision. |
xsmaddasp | xt, xa, xb | XX3 60/1 | ISA 2.07 | Scalar multiply-add type-A, single-precision. |
xsmaddmsp | xt, xa, xb | XX3 60/9 | ISA 2.07 | Scalar multiply-add type-M, single-precision. |
xsmsubasp | xt, xa, xb | XX3 60/17 | ISA 2.07 | Scalar multiply-subtract type-A, single-precision. |
xsmsubmsp | xt, xa, xb | XX3 60/25 | ISA 2.07 | Scalar multiply-subtract type-M, single-precision. |
xsnmaddasp | xt, xa, xb | XX3 60/129 | ISA 2.07 | Scalar negative multiply-add type-A, single-precision. |
xsnmaddmsp | xt, xa, xb | XX3 60/137 | ISA 2.07 | Scalar negative multiply-add type-M, single-precision. |
xsnmsubasp | xt, xa, xb | XX3 60/145 | ISA 2.07 | Scalar negative multiply-subtract type-A, single-precision. |
xsnmsubmsp | xt, xa, xb | XX3 60/153 | ISA 2.07 | Scalar negative multiply-subtract type-M, single-precision. |
xsmaxdp | xt, xa, xb | XX3 60/160 | VSX | Scalar maximum, double-precision. |
xsmindp | xt, xa, xb | XX3 60/168 | VSX | Scalar minimum, double-precision. |
xscpsgndp | xt, xa, xb | XX3 60/176 | VSX | Scalar copy sign, double-precision. |
xscmpeqdp | xt, xa, xb | XX3 60/3 | ISA 3.0 | Scalar compare equal, double-precision (result is a mask in xt). |
xscmpgtdp | xt, xa, xb | XX3 60/11 | ISA 3.0 | Scalar compare greater than, double-precision. |
xscmpgedp | xt, xa, xb | XX3 60/19 | ISA 3.0 | Scalar compare greater than or equal, double-precision. |
xsmaxcdp | xt, xa, xb | XX3 60/128 | ISA 3.0 | Scalar maximum type-C, double-precision. |
xsmincdp | xt, xa, xb | XX3 60/136 | ISA 3.0 | Scalar minimum type-C, double-precision. |
xsmaxjdp | xt, xa, xb | XX3 60/144 | ISA 3.0 | Scalar maximum type-J, double-precision. |
xsminjdp | xt, xa, xb | XX3 60/152 | ISA 3.0 | Scalar minimum type-J, double-precision. |
VSX vector arithmetic
The vector instructions work on two double-precision (dp) or four single-precision (sp) values.
Operands are xt, xa, xb.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
xvadddp | xt, xa, xb | XX3 60/96 | VSX | Vector add, double-precision. |
xvaddsp | xt, xa, xb | XX3 60/64 | VSX | Vector add, single-precision. |
xvsubdp | xt, xa, xb | XX3 60/104 | VSX | Vector subtract, double-precision. |
xvsubsp | xt, xa, xb | XX3 60/72 | VSX | Vector subtract, single-precision. |
xvmuldp | xt, xa, xb | XX3 60/112 | VSX | Vector multiply, double-precision. |
xvmulsp | xt, xa, xb | XX3 60/80 | VSX | Vector multiply, single-precision. |
xvdivdp | xt, xa, xb | XX3 60/120 | VSX | Vector divide, double-precision. |
xvdivsp | xt, xa, xb | XX3 60/88 | VSX | Vector divide, single-precision. |
xvmaddadp | xt, xa, xb | XX3 60/97 | VSX | Vector multiply-add type-A, double-precision. |
xvmaddmdp | xt, xa, xb | XX3 60/105 | VSX | Vector multiply-add type-M, double-precision. |
xvmsubadp | xt, xa, xb | XX3 60/113 | VSX | Vector multiply-subtract type-A, double-precision. |
xvmsubmdp | xt, xa, xb | XX3 60/121 | VSX | Vector multiply-subtract type-M, double-precision. |
xvnmaddadp | xt, xa, xb | XX3 60/225 | VSX | Vector negative multiply-add type-A, double-precision. |
xvnmaddmdp | xt, xa, xb | XX3 60/233 | VSX | Vector negative multiply-add type-M, double-precision. |
xvnmsubadp | xt, xa, xb | XX3 60/241 | VSX | Vector negative multiply-subtract type-A, double-precision. |
xvnmsubmdp | xt, xa, xb | XX3 60/249 | VSX | Vector negative multiply-subtract type-M, double-precision. |
xvmaddasp | xt, xa, xb | XX3 60/65 | VSX | Vector multiply-add type-A, single-precision. |
xvmaddmsp | xt, xa, xb | XX3 60/73 | VSX | Vector multiply-add type-M, single-precision. |
xvmsubasp | xt, xa, xb | XX3 60/81 | VSX | Vector multiply-subtract type-A, single-precision. |
xvmsubmsp | xt, xa, xb | XX3 60/89 | VSX | Vector multiply-subtract type-M, single-precision. |
xvnmaddasp | xt, xa, xb | XX3 60/193 | VSX | Vector negative multiply-add type-A, single-precision. |
xvnmaddmsp | xt, xa, xb | XX3 60/201 | VSX | Vector negative multiply-add type-M, single-precision. |
xvnmsubasp | xt, xa, xb | XX3 60/209 | VSX | Vector negative multiply-subtract type-A, single-precision. |
xvnmsubmsp | xt, xa, xb | XX3 60/217 | VSX | Vector negative multiply-subtract type-M, single-precision. |
xvmaxdp | xt, xa, xb | XX3 60/224 | VSX | Vector maximum, double-precision. |
xvmindp | xt, xa, xb | XX3 60/232 | VSX | Vector minimum, double-precision. |
xvmaxsp | xt, xa, xb | XX3 60/192 | VSX | Vector maximum, single-precision. |
xvminsp | xt, xa, xb | XX3 60/200 | VSX | Vector minimum, single-precision. |
xvcpsgndp | xt, xa, xb | XX3 60/240 | VSX | Vector copy sign, double-precision. |
xvcpsgnsp | xt, xa, xb | XX3 60/208 | VSX | Vector copy sign, single-precision. |
VSX logical, merge and permute
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
xxland | xt, xa, xb | XX3 60/130 | VSX | Logical AND. |
xxlandc | xt, xa, xb | XX3 60/138 | VSX | Logical AND with complement. |
xxlor | xt, xa, xb | XX3 60/146 | VSX | Logical OR. |
xxlxor | xt, xa, xb | XX3 60/154 | VSX | Logical XOR. |
xxlnor | xt, xa, xb | XX3 60/162 | VSX | Logical NOR. |
xxlorc | xt, xa, xb | XX3 60/170 | ISA 2.07 | Logical OR with complement. |
xxlnand | xt, xa, xb | XX3 60/178 | ISA 2.07 | Logical NAND. |
xxleqv | xt, xa, xb | XX3 60/186 | ISA 2.07 | Logical equivalence (XNOR). |
xxmrghw | xt, xa, xb | XX3 60/18 | VSX | Merge the high words. |
xxmrglw | xt, xa, xb | XX3 60/50 | VSX | Merge the low words. |
xxperm | xt, xa, xb | XX3 60/26 | ISA 3.0 | Vector permute. |
xxpermr | xt, xa, xb | XX3 60/58 | ISA 3.0 | Vector permute, right-indexed. |
VSX compare and test
The vector compares write a mask like the AltiVec ones; the dotted form (record bit 21) also sets condition register field 6.
xscmpudp, xscmpodp, xscmpexpdp and the test instructions write a condition register field
bf instead of a register.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
xvcmpeqdp, xvcmpeqdp. | xt, xa, xb | XX3 60/99 (Rc bit 21) | VSX | Vector compare equal, double-precision. |
xvcmpgedp, xvcmpgedp. | xt, xa, xb | XX3 60/115 (Rc bit 21) | VSX | Vector compare greater than or equal, double-precision. |
xvcmpgtdp, xvcmpgtdp. | xt, xa, xb | XX3 60/107 (Rc bit 21) | VSX | Vector compare greater than, double-precision. |
xvcmpeqsp, xvcmpeqsp. | xt, xa, xb | XX3 60/67 (Rc bit 21) | VSX | Vector compare equal, single-precision. |
xvcmpgesp, xvcmpgesp. | xt, xa, xb | XX3 60/83 (Rc bit 21) | VSX | Vector compare greater than or equal, single-precision. |
xvcmpgtsp, xvcmpgtsp. | xt, xa, xb | XX3 60/75 (Rc bit 21) | VSX | Vector compare greater than, single-precision. |
xscmpudp | bf, xa, xb | XX3 60/35 (BF in bits 6-8) | VSX | Scalar compare unordered, double-precision. |
xscmpodp | bf, xa, xb | XX3 60/43 (BF in bits 6-8) | VSX | Scalar compare ordered, double-precision. |
xstdivdp | bf, xa, xb | XX3 60/61 (BF in bits 6-8) | VSX | Scalar test for software divide, double-precision. |
xvtdivdp | bf, xa, xb | XX3 60/125 (BF in bits 6-8) | VSX | Vector test for software divide, double-precision. |
xvtdivsp | bf, xa, xb | XX3 60/93 (BF in bits 6-8) | VSX | Vector test for software divide, single-precision. |
xscmpexpdp | bf, xa, xb | XX3 60/59 (BF in bits 6-8) | ISA 3.0 | Scalar compare exponents, double-precision. |
xstsqrtdp | bf, xb | XX2 60/106 (BF in bits 6-8) | VSX | Scalar test for software square root, double-precision. |
xvtsqrtdp | bf, xb | XX2 60/234 (BF in bits 6-8) | VSX | Vector test for software square root, double-precision. |
xvtsqrtsp | bf, xb | XX2 60/170 (BF in bits 6-8) | VSX | Vector test for software square root, single-precision. |
VSX convert, round, estimate, square root and sign
All of these take one source register: xt, xb.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
xsabsdp | xt, xb | XX2 60/345 | VSX | Scalar absolute value, double-precision. |
xsnabsdp | xt, xb | XX2 60/361 | VSX | Scalar negative absolute value, double-precision. |
xsnegdp | xt, xb | XX2 60/377 | VSX | Scalar negate, double-precision. |
xscvdpsp | xt, xb | XX2 60/265 | VSX | Scalar convert double-precision to single-precision. |
xscvspdp | xt, xb | XX2 60/329 | VSX | Scalar convert single-precision to double-precision. |
xscvdpspn | xt, xb | XX2 60/267 | ISA 2.07 | Scalar convert double-precision to single-precision, non-signalling. |
xscvspdpn | xt, xb | XX2 60/331 | ISA 2.07 | Scalar convert single-precision to double-precision, non-signalling. |
xscvdpsxds | xt, xb | XX2 60/344 | VSX | Scalar convert double-precision to signed doubleword. |
xscvdpsxws | xt, xb | XX2 60/88 | VSX | Scalar convert double-precision to signed word. |
xscvdpuxds | xt, xb | XX2 60/328 | VSX | Scalar convert double-precision to unsigned doubleword. |
xscvdpuxws | xt, xb | XX2 60/72 | VSX | Scalar convert double-precision to unsigned word. |
xscvsxddp | xt, xb | XX2 60/376 | VSX | Scalar convert signed doubleword to double-precision. |
xscvuxddp | xt, xb | XX2 60/360 | VSX | Scalar convert unsigned doubleword to double-precision. |
xscvsxdsp | xt, xb | XX2 60/312 | ISA 2.07 | Scalar convert signed doubleword to single-precision. |
xscvuxdsp | xt, xb | XX2 60/296 | ISA 2.07 | Scalar convert unsigned doubleword to single-precision. |
xsrdpi | xt, xb | XX2 60/73 | VSX | Scalar round to double-precision integer (to nearest, ties away from zero). |
xsrdpic | xt, xb | XX2 60/107 | VSX | Scalar round to double-precision integer using the current rounding mode. |
xsrdpim | xt, xb | XX2 60/121 | VSX | Scalar round to double-precision integer toward -infinity. |
xsrdpip | xt, xb | XX2 60/105 | VSX | Scalar round to double-precision integer toward +infinity. |
xsrdpiz | xt, xb | XX2 60/89 | VSX | Scalar round to double-precision integer toward zero. |
xsredp | xt, xb | XX2 60/90 | VSX | Scalar reciprocal estimate, double-precision. |
xsrsqrtedp | xt, xb | XX2 60/74 | VSX | Scalar reciprocal square root estimate, double-precision. |
xssqrtdp | xt, xb | XX2 60/75 | VSX | Scalar square root, double-precision. |
xsrsp | xt, xb | XX2 60/281 | ISA 2.07 | Scalar round to single-precision. |
xsresp | xt, xb | XX2 60/26 | ISA 2.07 | Scalar reciprocal estimate, single-precision. |
xsrsqrtesp | xt, xb | XX2 60/10 | ISA 2.07 | Scalar reciprocal square root estimate, single-precision. |
xssqrtsp | xt, xb | XX2 60/11 | ISA 2.07 | Scalar square root, single-precision. |
xvabsdp | xt, xb | XX2 60/473 | VSX | Vector absolute value, double-precision. |
xvabssp | xt, xb | XX2 60/409 | VSX | Vector absolute value, single-precision. |
xvnabsdp | xt, xb | XX2 60/489 | VSX | Vector negative absolute value, double-precision. |
xvnabssp | xt, xb | XX2 60/425 | VSX | Vector negative absolute value, single-precision. |
xvnegdp | xt, xb | XX2 60/505 | VSX | Vector negate, double-precision. |
xvnegsp | xt, xb | XX2 60/441 | VSX | Vector negate, single-precision. |
xvcvdpsp | xt, xb | XX2 60/393 | VSX | Vector convert double-precision to single-precision. |
xvcvspdp | xt, xb | XX2 60/457 | VSX | Vector convert single-precision to double-precision. |
xvcvdpsxds | xt, xb | XX2 60/472 | VSX | Vector convert double-precision to signed doubleword. |
xvcvdpsxws | xt, xb | XX2 60/216 | VSX | Vector convert double-precision to signed word. |
xvcvdpuxds | xt, xb | XX2 60/456 | VSX | Vector convert double-precision to unsigned doubleword. |
xvcvdpuxws | xt, xb | XX2 60/200 | VSX | Vector convert double-precision to unsigned word. |
xvcvspsxds | xt, xb | XX2 60/408 | VSX | Vector convert single-precision to signed doubleword. |
xvcvspsxws | xt, xb | XX2 60/152 | VSX | Vector convert single-precision to signed word. |
xvcvspuxds | xt, xb | XX2 60/392 | VSX | Vector convert single-precision to unsigned doubleword. |
xvcvspuxws | xt, xb | XX2 60/136 | VSX | Vector convert single-precision to unsigned word. |
xvcvsxddp | xt, xb | XX2 60/504 | VSX | Vector convert signed doubleword to double-precision. |
xvcvsxdsp | xt, xb | XX2 60/440 | VSX | Vector convert signed doubleword to single-precision. |
xvcvsxwdp | xt, xb | XX2 60/248 | VSX | Vector convert signed word to double-precision. |
xvcvsxwsp | xt, xb | XX2 60/184 | VSX | Vector convert signed word to single-precision. |
xvcvuxddp | xt, xb | XX2 60/488 | VSX | Vector convert unsigned doubleword to double-precision. |
xvcvuxdsp | xt, xb | XX2 60/424 | VSX | Vector convert unsigned doubleword to single-precision. |
xvcvuxwdp | xt, xb | XX2 60/232 | VSX | Vector convert unsigned word to double-precision. |
xvcvuxwsp | xt, xb | XX2 60/168 | VSX | Vector convert unsigned word to single-precision. |
xvrdpi | xt, xb | XX2 60/201 | VSX | Vector round to double-precision integer. |
xvrdpic | xt, xb | XX2 60/235 | VSX | Vector round to double-precision integer using the current rounding mode. |
xvrdpim | xt, xb | XX2 60/249 | VSX | Vector round to double-precision integer toward -infinity. |
xvrdpip | xt, xb | XX2 60/233 | VSX | Vector round to double-precision integer toward +infinity. |
xvrdpiz | xt, xb | XX2 60/217 | VSX | Vector round to double-precision integer toward zero. |
xvrspi | xt, xb | XX2 60/137 | VSX | Vector round to single-precision integer. |
xvrspic | xt, xb | XX2 60/171 | VSX | Vector round to single-precision integer using the current rounding mode. |
xvrspim | xt, xb | XX2 60/185 | VSX | Vector round to single-precision integer toward -infinity. |
xvrspip | xt, xb | XX2 60/169 | VSX | Vector round to single-precision integer toward +infinity. |
xvrspiz | xt, xb | XX2 60/153 | VSX | Vector round to single-precision integer toward zero. |
xvredp | xt, xb | XX2 60/218 | VSX | Vector reciprocal estimate, double-precision. |
xvresp | xt, xb | XX2 60/154 | VSX | Vector reciprocal estimate, single-precision. |
xvrsqrtedp | xt, xb | XX2 60/202 | VSX | Vector reciprocal square root estimate, double-precision. |
xvrsqrtesp | xt, xb | XX2 60/138 | VSX | Vector reciprocal square root estimate, single-precision. |
xvsqrtdp | xt, xb | XX2 60/203 | VSX | Vector square root, double-precision. |
xvsqrtsp | xt, xb | XX2 60/139 | VSX | Vector square root, single-precision. |
VSX permute, shift, splat and select
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
xxpermdi | xt, xa, xb, dm | XX3 60/10 (DM in bits 22-23) | VSX | Permute doubleword immediate: DM picks a doubleword of xa and one of xb. |
xxsldwi | xt, xa, xb, shw | XX3 60/2 (SHW in bits 22-23) | VSX | Shift left double by word immediate. |
xxspltw | xt, xb, uimw | XX2 60/164 (UIM in bits 14-15) | VSX | Splat word: every word of xt is word UIM of xb. |
xxsel | xt, xa, xb, xc | XX4 60/3 | VSX | Select: bits of xb where xc is 1, else xa. |
xxspltib | xt, imm8 | 60/360 (IMM8 in bits 13-20) | ISA 3.0 | Splat an immediate byte to every byte. |
VSX loads and stores
These are indexed, (ra|0) + rb, in the X form. lxvl and
stxvl move a number of bytes given in the high byte of rb.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
lxsdx | xt, ra0, rb | X 31/588 | VSX | Load scalar doubleword indexed. |
lxsspx | xt, ra0, rb | X 31/524 | ISA 2.07 | Load scalar single-precision indexed. |
lxsiwax | xt, ra0, rb | X 31/76 | ISA 2.07 | Load scalar as integer word algebraic indexed. |
lxsiwzx | xt, ra0, rb | X 31/12 | ISA 2.07 | Load scalar as integer word and zero indexed. |
lxvd2x | xt, ra0, rb | X 31/844 | VSX | Load vector of two doublewords indexed. |
lxvw4x | xt, ra0, rb | X 31/780 | VSX | Load vector of four words indexed. |
lxvdsx | xt, ra0, rb | X 31/332 | VSX | Load a doubleword and splat it to both doublewords. |
lxvh8x | xt, ra0, rb | X 31/812 | ISA 3.0 | Load vector of eight halfwords indexed. |
lxvb16x | xt, ra0, rb | X 31/876 | ISA 3.0 | Load vector of sixteen bytes indexed. |
lxvx | xt, ra0, rb | X 31/268 | ISA 3.0 | Load vector indexed. |
lxvwsx | xt, ra0, rb | X 31/364 | ISA 3.0 | Load a word and splat it to every word. |
lxvl | xt, ra0, rb | X 31/269 | ISA 3.0 | Load vector with length (in rb). |
lxvll | xt, ra0, rb | X 31/301 | ISA 3.0 | Load vector with length, left-justified. |
stxsdx | xs, ra0, rb | X 31/716 | VSX | Store scalar doubleword indexed. |
stxsspx | xs, ra0, rb | X 31/652 | ISA 2.07 | Store scalar single-precision indexed. |
stxsiwx | xs, ra0, rb | X 31/140 | ISA 2.07 | Store scalar as integer word indexed. |
stxvd2x | xs, ra0, rb | X 31/972 | VSX | Store vector of two doublewords indexed. |
stxvw4x | xs, ra0, rb | X 31/908 | VSX | Store vector of four words indexed. |
stxvh8x | xs, ra0, rb | X 31/940 | ISA 3.0 | Store vector of eight halfwords indexed. |
stxvb16x | xs, ra0, rb | X 31/1004 | ISA 3.0 | Store vector of sixteen bytes indexed. |
stxvx | xs, ra0, rb | X 31/396 | ISA 3.0 | Store vector indexed. |
stxvl | xs, ra0, rb | X 31/397 | ISA 3.0 | Store vector with length. |
stxvll | xs, ra0, rb | X 31/429 | ISA 3.0 | Store vector with length, left-justified. |
lxv | xtq, dq(ra0) | DQ 61 (low bits 001) | ISA 3.0 | Load vector, with a 16-byte multiple displacement. |
stxv | xtq, dq(ra0) | DQ 61 (low bits 101) | ISA 3.0 | Store vector, with a 16-byte multiple displacement. |
lxsd | vrt, ds(ra0) | DS 57/2 | ISA 3.0 | Load scalar doubleword into a vector register. |
lxssp | vrt, ds(ra0) | DS 57/3 | ISA 3.0 | Load scalar single-precision into a vector register. |
stxsd | vrs, ds(ra0) | DS 61/2 | ISA 3.0 | Store scalar doubleword from a vector register. |
stxssp | vrs, ds(ra0) | DS 61/3 | ISA 3.0 | Store scalar single-precision from a vector register. |
Moves between general registers and VSX registers
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
mfvsrd | ra, xs | X 31/51 | ISA 2.07 | Move from the doubleword of a VSX register to a general register. |
mfvsrwz | ra, xs | X 31/115 | ISA 2.07 | Move from a VSX register word, zero-extended, to a general register. |
mtvsrd | xt, ra | X 31/179 | ISA 2.07 | Move a general register to the doubleword of a VSX register. |
mtvsrwa | xt, ra | X 31/211 | ISA 2.07 | Move to a VSX register word, algebraic (sign-extended). |
mtvsrwz | xt, ra | X 31/243 | ISA 2.07 | Move to a VSX register word, zero-extended. |
mfvsrld | ra, xs | X 31/307 | ISA 3.0 | Move from the lower doubleword of a VSX register to a general register. |
mtvsrdd | xt, ra0, rb | X 31/435 | ISA 3.0 | Move two general registers to the two doublewords of a VSX register. |
mtvsrws | xt, ra | X 31/403 | ISA 3.0 | Move a general register to a VSX register word and splat it. |
Quadword load and store
These move 16 bytes to or from an even-odd pair of general registers. They are 64-bit instructions of Power ISA 2.01 and later; they are not vector instructions but are listed here with the other 16-byte accesses.
| Mnemonic | Operands | Form and opcode | Available in | What it does |
|---|---|---|---|---|
lq | rtp, dq(ra0) | DQ 56 | 64-bit, ISA 2.01 and later | Load quadword into an even-odd register pair. |
stq | rsp, ds(ra0) | DS 62/2 | 64-bit, ISA 2.01 and later | Store quadword from an even-odd register pair. |
Not described
Known, not yet covered
- Reference and viewer: VMX128, the Xbox 360 Xenon extension with 128 vector registers and its own encodings.
- Reference and viewer: the quad-precision floating-point instructions of Power ISA 3.0 (
xsaddqpand the others), the vector instructions that Power ISA 3.1 added, and the 8-byte prefixed instructions of Power ISA 3.1. - Reference and viewer: decimal floating point, and the transactional memory instructions.
- Reference and viewer: the remaining Power ISA 3.0 vector instructions (
vextu*,vinsert*,vslv,vsrv,vrlwnmand others) that the explorer does not decode.
Unknown
- Reference: none known.
Links
Reference
- Power ISA specifications – the instruction set manuals, including the vector facility (Book I) and VSX
- The LLVM code generator – the PowerPC target used to check the decoder