Introduction
AVX-512 FP16 does arithmetic on half-precision numbers: IEEE 754 binary16, with a sign bit, 5 exponent bits and 10 fraction bits. Before it, x86 could only convert halves to and from single precision (F16C, and the same conversions in AVX-512 Foundation). FP16 adds the whole set of floating-point operations for them: add, subtract, multiply, divide, square root, minimum and maximum, fused multiply-add, compares, the AVX-512 helpers (VGETEXP, VGETMANT, VREDUCE, VRNDSCALE, VSCALEF, VFPCLASS), conversions to and from every integer and floating-point type, and multiplies of complex numbers.
The instructions use the AVX-512 state. A packed instruction works on 8, 16 or 32
halves in an xmm, ymm or zmm register (xmm0 to xmm31 and so on); a scalar one (the
sh forms) works on the low word of an xmm register and copies the rest of
the first source. The mask registers k1 to k7 select which elements are written, with
merging or zeroing ({z}). The rounding mode comes from MXCSR, or from the
instruction itself ({er}) on the 512-bit and scalar register forms.
Intel brought FP16 with the Xeon processors code-named Sapphire Rapids (January 2023). It is also part of AVX10.1, so every AVX10 processor has it. A program checks CPUID.(EAX=07H, ECX=0):EDX[bit 23] (AVX512-FP16), and for the 128-bit and 256-bit forms also AVX512VL, CPUID.(EAX=07H, ECX=0):EBX[bit 31].
Most of the instructions sit in two EVEX opcode maps that FP16 added: map 5 holds the half-precision forms of the 0F map’s floating-point instructions, at the same opcodes, and map 6 those of the 0F 38 map. The ones that take an immediate are in the 0F 3A map, with no prefix, beside their ps and pd forms. AVX10.2 later put its BF16 instructions at the same opcodes with other prefixes.
When the explorer disassembles a program, each instruction it shows links to its row on these pages.
Instructions
Packed forms are shown at 512 bits. Each also has a 128-bit and a 256-bit form
(EVEX.128 and EVEX.256, with xmm and ymm registers and m128 and m256 memory), without
{er} or {sae}. Scalar forms (EVEX.LLIG) ignore the vector
length. m16bcst is a single half in memory broadcast to every element.
Arithmetic
| Instruction | Forms | Encoding | What it does | Set |
|---|---|---|---|---|
vaddph | zmm1 {k1}{z}, zmm2, zmm3/m512/m16bcst {er} | EVEX.512.NP.MAP5.W0 58 /r | Adds packed halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vaddsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {er} | EVEX.LLIG.F3.MAP5.W0 58 /r | Adds the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vsubph | zmm1 {k1}{z}, zmm2, zmm3/m512/m16bcst {er} | EVEX.512.NP.MAP5.W0 5C /r | Subtracts the second source’s halves from the first’s. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vsubsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {er} | EVEX.LLIG.F3.MAP5.W0 5C /r | Subtracts the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vmulph | zmm1 {k1}{z}, zmm2, zmm3/m512/m16bcst {er} | EVEX.512.NP.MAP5.W0 59 /r | Multiplies packed halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vmulsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {er} | EVEX.LLIG.F3.MAP5.W0 59 /r | Multiplies the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vdivph | zmm1 {k1}{z}, zmm2, zmm3/m512/m16bcst {er} | EVEX.512.NP.MAP5.W0 5E /r | Divides the first source’s halves by the second’s. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vdivsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {er} | EVEX.LLIG.F3.MAP5.W0 5E /r | Divides the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vminph | zmm1 {k1}{z}, zmm2, zmm3/m512/m16bcst {sae} | EVEX.512.NP.MAP5.W0 5D /r | The smaller of each pair of halves; as MINPS, the second source is returned when either is a NaN or both are zero. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vminsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {sae} | EVEX.LLIG.F3.MAP5.W0 5D /r | The smaller of the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vmaxph | zmm1 {k1}{z}, zmm2, zmm3/m512/m16bcst {sae} | EVEX.512.NP.MAP5.W0 5F /r | The larger of each pair of halves, with the same NaN and zero rule. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vmaxsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {sae} | EVEX.LLIG.F3.MAP5.W0 5F /r | The larger of the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vsqrtph | zmm1 {k1}{z}, zmm2/m512/m16bcst {er} | EVEX.512.NP.MAP5.W0 51 /r | Square root of each half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vsqrtsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {er} | EVEX.LLIG.F3.MAP5.W0 51 /r | Square root of the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vrcpph | zmm1 {k1}{z}, zmm2/m512/m16bcst | EVEX.512.66.MAP6.W0 4C /r | Approximate reciprocal of each half (relative error below 2−11 + 2−14). | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vrcpsh | xmm1 {k1}{z}, xmm2, xmm3/m16 | EVEX.LLIG.66.MAP6.W0 4D /r | Approximate reciprocal of the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vrsqrtph | zmm1 {k1}{z}, zmm2/m512/m16bcst | EVEX.512.66.MAP6.W0 4E /r | Approximate reciprocal square root of each half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vrsqrtsh | xmm1 {k1}{z}, xmm2, xmm3/m16 | EVEX.LLIG.66.MAP6.W0 4F /r | Approximate reciprocal square root of the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
Fused multiply-add
As in FMA3, the digits give the order of the
operands: 132 is dest = dest × src3 + src2, 213 is
dest = src2 × dest + src3, 231 is dest = src2 × src3 + dest,
with one rounding at the end. Every form is
zmm1 {k1}{z}, zmm2, zmm3/m512/m16bcst {er} (packed) or
xmm1 {k1}{z}, xmm2, xmm3/m16 {er} (scalar).
| Instruction | Forms | Encoding | What it does | Set |
|---|---|---|---|---|
vfmadd132ph | packed | EVEX.512.66.MAP6.W0 98 /r | Multiply, then add. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmadd213ph | packed | EVEX.512.66.MAP6.W0 A8 /r | Multiply, then add. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmadd231ph | packed | EVEX.512.66.MAP6.W0 B8 /r | Multiply, then add. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmadd132sh | scalar | EVEX.LLIG.66.MAP6.W0 99 /r | Multiply, then add, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmadd213sh | scalar | EVEX.LLIG.66.MAP6.W0 A9 /r | Multiply, then add, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmadd231sh | scalar | EVEX.LLIG.66.MAP6.W0 B9 /r | Multiply, then add, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsub132ph | packed | EVEX.512.66.MAP6.W0 9A /r | Multiply, then subtract the addend. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsub213ph | packed | EVEX.512.66.MAP6.W0 AA /r | Multiply, then subtract the addend. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsub231ph | packed | EVEX.512.66.MAP6.W0 BA /r | Multiply, then subtract the addend. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsub132sh | scalar | EVEX.LLIG.66.MAP6.W0 9B /r | Multiply, then subtract, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsub213sh | scalar | EVEX.LLIG.66.MAP6.W0 AB /r | Multiply, then subtract, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsub231sh | scalar | EVEX.LLIG.66.MAP6.W0 BB /r | Multiply, then subtract, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmadd132ph | packed | EVEX.512.66.MAP6.W0 9C /r | Negate the product, then add. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmadd213ph | packed | EVEX.512.66.MAP6.W0 AC /r | Negate the product, then add. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmadd231ph | packed | EVEX.512.66.MAP6.W0 BC /r | Negate the product, then add. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmadd132sh | scalar | EVEX.LLIG.66.MAP6.W0 9D /r | Negate the product, then add, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmadd213sh | scalar | EVEX.LLIG.66.MAP6.W0 AD /r | Negate the product, then add, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmadd231sh | scalar | EVEX.LLIG.66.MAP6.W0 BD /r | Negate the product, then add, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmsub132ph | packed | EVEX.512.66.MAP6.W0 9E /r | Negate the product, then subtract the addend. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmsub213ph | packed | EVEX.512.66.MAP6.W0 AE /r | Negate the product, then subtract the addend. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmsub231ph | packed | EVEX.512.66.MAP6.W0 BE /r | Negate the product, then subtract the addend. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmsub132sh | scalar | EVEX.LLIG.66.MAP6.W0 9F /r | Negate the product, then subtract, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmsub213sh | scalar | EVEX.LLIG.66.MAP6.W0 AF /r | Negate the product, then subtract, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfnmsub231sh | scalar | EVEX.LLIG.66.MAP6.W0 BF /r | Negate the product, then subtract, on the low halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmaddsub132ph | packed | EVEX.512.66.MAP6.W0 96 /r | Multiply, then subtract the addend in even elements and add it in odd ones. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmaddsub213ph | packed | EVEX.512.66.MAP6.W0 A6 /r | Multiply, then subtract in even elements and add in odd ones. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmaddsub231ph | packed | EVEX.512.66.MAP6.W0 B6 /r | Multiply, then subtract in even elements and add in odd ones. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsubadd132ph | packed | EVEX.512.66.MAP6.W0 97 /r | Multiply, then add the addend in even elements and subtract it in odd ones. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsubadd213ph | packed | EVEX.512.66.MAP6.W0 A7 /r | Multiply, then add in even elements and subtract in odd ones. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmsubadd231ph | packed | EVEX.512.66.MAP6.W0 B7 /r | Multiply, then add in even elements and subtract in odd ones. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
Complex multiplies
These treat each dword as a complex number: the real part in the low half, the
imaginary part in the high half. Masking and broadcast work on whole dwords
(m32bcst). The fc forms multiply by the complex conjugate of
the last source.
| Instruction | Forms | Encoding | What it does | Set |
|---|---|---|---|---|
vfmulcph | zmm1 {k1}{z}, zmm2, zmm3/m512/m32bcst {er} | EVEX.512.F3.MAP6.W0 D6 /r | Multiplies the complex numbers. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfcmulcph | zmm1 {k1}{z}, zmm2, zmm3/m512/m32bcst {er} | EVEX.512.F2.MAP6.W0 D6 /r | Multiplies by the conjugates. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmulcsh | xmm1 {k1}{z}, xmm2, xmm3/m32 {er} | EVEX.LLIG.F3.MAP6.W0 D7 /r | Multiplies the low complex numbers. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfcmulcsh | xmm1 {k1}{z}, xmm2, xmm3/m32 {er} | EVEX.LLIG.F2.MAP6.W0 D7 /r | Multiplies the low complex number by the conjugate. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmaddcph | zmm1 {k1}{z}, zmm2, zmm3/m512/m32bcst {er} | EVEX.512.F3.MAP6.W0 56 /r | Multiplies the complex numbers and adds the products to the destination. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfcmaddcph | zmm1 {k1}{z}, zmm2, zmm3/m512/m32bcst {er} | EVEX.512.F2.MAP6.W0 56 /r | Multiplies by the conjugates and adds to the destination. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfmaddcsh | xmm1 {k1}{z}, xmm2, xmm3/m32 {er} | EVEX.LLIG.F3.MAP6.W0 57 /r | The same on the low complex number. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfcmaddcsh | xmm1 {k1}{z}, xmm2, xmm3/m32 {er} | EVEX.LLIG.F2.MAP6.W0 57 /r | The same with the conjugate, on the low complex number. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
Exponent, mantissa, rounding and class
| Instruction | Forms | Encoding | What it does | Set |
|---|---|---|---|---|
vgetexpph | zmm1 {k1}{z}, zmm2/m512/m16bcst {sae} | EVEX.512.66.MAP6.W0 42 /r | The unbiased exponent of each half, as a half (floor(log2|x|)). | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vgetexpsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {sae} | EVEX.LLIG.66.MAP6.W0 43 /r | The exponent of the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vgetmantph | zmm1 {k1}{z}, zmm2/m512/m16bcst {sae}, imm8 | EVEX.512.NP.0F3A.W0 26 /r ib | The mantissa of each half, normalised to the interval and sign that imm8 selects. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vgetmantsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {sae}, imm8 | EVEX.LLIG.NP.0F3A.W0 27 /r ib | The mantissa of the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vscalefph | zmm1 {k1}{z}, zmm2, zmm3/m512/m16bcst {er} | EVEX.512.66.MAP6.W0 2C /r | Multiplies each half of the first source by 2 to the power floor(second source). | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vscalefsh | xmm1 {k1}{z}, xmm2, xmm3/m16 {er} | EVEX.LLIG.66.MAP6.W0 2D /r | The same on the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vrndscaleph | zmm1 {k1}{z}, zmm2/m512/m16bcst {sae}, imm8 | EVEX.512.NP.0F3A.W0 08 /r ib | Rounds each half to the number of fraction bits in imm8[7:4], with the rounding in imm8[3:0]. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vrndscalesh | xmm1 {k1}{z}, xmm2, xmm3/m16 {sae}, imm8 | EVEX.LLIG.NP.0F3A.W0 0A /r ib | The same on the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vreduceph | zmm1 {k1}{z}, zmm2/m512/m16bcst {sae}, imm8 | EVEX.512.NP.0F3A.W0 56 /r ib | What is left of each half after VRNDSCALE’s rounding: x minus the rounded x. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vreducesh | xmm1 {k1}{z}, xmm2, xmm3/m16 {sae}, imm8 | EVEX.LLIG.NP.0F3A.W0 57 /r ib | The same on the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfpclassph | k1 {k2}, zmm2/m512/m16bcst, imm8 | EVEX.512.NP.0F3A.W0 66 /r ib | Sets a mask bit for each half that is in any of the classes imm8 selects (QNaN, ±0, ±infinity, denormal, negative, SNaN). | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vfpclasssh | k1 {k2}, xmm2/m16, imm8 | EVEX.LLIG.NP.0F3A.W0 67 /r ib | The same for the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
Compares
| Instruction | Forms | Encoding | What it does | Set |
|---|---|---|---|---|
vcmpph | k1 {k2}, zmm2, zmm3/m512/m16bcst {sae}, imm8 | EVEX.512.NP.0F3A.W0 C2 /r ib | Compares each pair of halves by the predicate in imm8[4:0] and sets a mask bit for each that holds. Predicate names (imm8 0 to 31): vcmpeqph, vcmpltph, vcmpleph, vcmpunordph, vcmpneqph, vcmpnltph, vcmpnleph, vcmpordph, vcmpeq_uqph, vcmpngeph, vcmpngtph, vcmpfalseph, vcmpneq_oqph, vcmpgeph, vcmpgtph, vcmptrueph, vcmpeq_osph, vcmplt_oqph, vcmple_oqph, vcmpunord_sph, vcmpneq_usph, vcmpnlt_uqph, vcmpnle_uqph, vcmpord_sph, vcmpeq_usph, vcmpnge_uqph, vcmpngt_uqph, vcmpfalse_osph, vcmpneq_osph, vcmpge_oqph, vcmpgt_oqph, vcmptrue_usph. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcmpsh | k1 {k2}, xmm2, xmm3/m16 {sae}, imm8 | EVEX.LLIG.F3.0F3A.W0 C2 /r ib | Compares the low halves and sets mask bit 0; the other bits are cleared. Predicate names (imm8 0 to 31): vcmpeqsh, vcmpltsh, vcmplesh, vcmpunordsh, vcmpneqsh, vcmpnltsh, vcmpnlesh, vcmpordsh, vcmpeq_uqsh, vcmpngesh, vcmpngtsh, vcmpfalsesh, vcmpneq_oqsh, vcmpgesh, vcmpgtsh, vcmptruesh, vcmpeq_ossh, vcmplt_oqsh, vcmple_oqsh, vcmpunord_ssh, vcmpneq_ussh, vcmpnlt_uqsh, vcmpnle_uqsh, vcmpord_ssh, vcmpeq_ussh, vcmpnge_uqsh, vcmpngt_uqsh, vcmpfalse_ossh, vcmpneq_ossh, vcmpge_oqsh, vcmpgt_oqsh, vcmptrue_ussh. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcomish | xmm1, xmm2/m16 {sae} | EVEX.LLIG.NP.MAP5.W0 2F /r | Compares the low halves and sets ZF, PF and CF as COMISS does (unordered: all three); clears OF, SF and AF. Signals invalid for any NaN. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vucomish | xmm1, xmm2/m16 {sae} | EVEX.LLIG.NP.MAP5.W0 2E /r | The same, signalling invalid only for a signalling NaN. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
Conversions between floating-point types
| Instruction | Forms | Encoding | What it does | Set |
|---|---|---|---|---|
vcvtph2psx | zmm1 {k1}{z}, ymm2/m256/m16bcst {sae} | EVEX.512.66.MAP6.W0 13 /r | Halves to singles. Unlike VCVTPH2PS, it can broadcast. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtps2phx | ymm1 {k1}{z}, zmm2/m512/m32bcst {er} | EVEX.512.66.MAP5.W0 1D /r | Singles to halves, rounded by MXCSR or {er}. Unlike VCVTPS2PH, which takes the rounding in an immediate, it can broadcast. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtph2pd | zmm1 {k1}{z}, xmm2/m128/m16bcst {sae} | EVEX.512.NP.MAP5.W0 5A /r | Halves to doubles. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtpd2ph | xmm1 {k1}{z}, zmm2/m512/m64bcst {er} | EVEX.512.66.MAP5.W1 5A /r | Doubles to halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtsh2ss | xmm1 {k1}{z}, xmm2, xmm3/m16 {sae} | EVEX.LLIG.NP.MAP6.W0 13 /r | The low half to a single. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtss2sh | xmm1 {k1}{z}, xmm2, xmm3/m32 {er} | EVEX.LLIG.NP.MAP5.W0 1D /r | The low single to a half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtsh2sd | xmm1 {k1}{z}, xmm2, xmm3/m16 {sae} | EVEX.LLIG.F3.MAP5.W0 5A /r | The low half to a double. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtsd2sh | xmm1 {k1}{z}, xmm2, xmm3/m64 {er} | EVEX.LLIG.F2.MAP5.W1 5A /r | The low double to a half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
Conversions to and from integers
The cvtt forms truncate (round towards zero); the others round by MXCSR or
{er}. A result out of range gives the integer indefinite value (the most
negative signed integer, or all ones for unsigned).
| Instruction | Forms | Encoding | What it does | Set |
|---|---|---|---|---|
vcvtph2w | zmm1 {k1}{z}, zmm2/m512/m16bcst {er} | EVEX.512.66.MAP5.W0 7D /r | Halves to signed words. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtph2uw | zmm1 {k1}{z}, zmm2/m512/m16bcst {er} | EVEX.512.NP.MAP5.W0 7D /r | Halves to unsigned words. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvttph2w | zmm1 {k1}{z}, zmm2/m512/m16bcst {sae} | EVEX.512.66.MAP5.W0 7C /r | Halves to signed words, truncated. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvttph2uw | zmm1 {k1}{z}, zmm2/m512/m16bcst {sae} | EVEX.512.NP.MAP5.W0 7C /r | Halves to unsigned words, truncated. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtw2ph | zmm1 {k1}{z}, zmm2/m512/m16bcst {er} | EVEX.512.F3.MAP5.W0 7D /r | Signed words to halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtuw2ph | zmm1 {k1}{z}, zmm2/m512/m16bcst {er} | EVEX.512.F2.MAP5.W0 7D /r | Unsigned words to halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtph2dq | zmm1 {k1}{z}, ymm2/m256/m16bcst {er} | EVEX.512.66.MAP5.W0 5B /r | Halves to signed dwords. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtph2udq | zmm1 {k1}{z}, ymm2/m256/m16bcst {er} | EVEX.512.NP.MAP5.W0 79 /r | Halves to unsigned dwords. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvttph2dq | zmm1 {k1}{z}, ymm2/m256/m16bcst {sae} | EVEX.512.F3.MAP5.W0 5B /r | Halves to signed dwords, truncated. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvttph2udq | zmm1 {k1}{z}, ymm2/m256/m16bcst {sae} | EVEX.512.NP.MAP5.W0 78 /r | Halves to unsigned dwords, truncated. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtdq2ph | ymm1 {k1}{z}, zmm2/m512/m32bcst {er} | EVEX.512.NP.MAP5.W0 5B /r | Signed dwords to halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtudq2ph | ymm1 {k1}{z}, zmm2/m512/m32bcst {er} | EVEX.512.F2.MAP5.W0 7A /r | Unsigned dwords to halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtph2qq | zmm1 {k1}{z}, xmm2/m128/m16bcst {er} | EVEX.512.66.MAP5.W0 7B /r | Halves to signed qwords. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtph2uqq | zmm1 {k1}{z}, xmm2/m128/m16bcst {er} | EVEX.512.66.MAP5.W0 79 /r | Halves to unsigned qwords. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvttph2qq | zmm1 {k1}{z}, xmm2/m128/m16bcst {sae} | EVEX.512.66.MAP5.W0 7A /r | Halves to signed qwords, truncated. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvttph2uqq | zmm1 {k1}{z}, xmm2/m128/m16bcst {sae} | EVEX.512.66.MAP5.W0 78 /r | Halves to unsigned qwords, truncated. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtqq2ph | xmm1 {k1}{z}, zmm2/m512/m64bcst {er} | EVEX.512.NP.MAP5.W1 5B /r | Signed qwords to halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtuqq2ph | xmm1 {k1}{z}, zmm2/m512/m64bcst {er} | EVEX.512.F2.MAP5.W1 7A /r | Unsigned qwords to halves. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtsh2si | r32, xmm1/m16 {er} (W0); r64, xmm1/m16 {er} (W1) | EVEX.LLIG.F3.MAP5.W0 2D /r, EVEX.LLIG.F3.MAP5.W1 2D /r | The low half to a signed integer in a general register. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtsh2usi | r32, xmm1/m16 {er}; r64, xmm1/m16 {er} | EVEX.LLIG.F3.MAP5.W0 79 /r, EVEX.LLIG.F3.MAP5.W1 79 /r | The low half to an unsigned integer. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvttsh2si | r32, xmm1/m16 {sae}; r64, xmm1/m16 {sae} | EVEX.LLIG.F3.MAP5.W0 2C /r, EVEX.LLIG.F3.MAP5.W1 2C /r | The low half to a signed integer, truncated. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvttsh2usi | r32, xmm1/m16 {sae}; r64, xmm1/m16 {sae} | EVEX.LLIG.F3.MAP5.W0 78 /r, EVEX.LLIG.F3.MAP5.W1 78 /r | The low half to an unsigned integer, truncated. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtsi2sh | xmm1, xmm2, r32/m32 {er}; xmm1, xmm2, r64/m64 {er} | EVEX.LLIG.F3.MAP5.W0 2A /r, EVEX.LLIG.F3.MAP5.W1 2A /r | A signed integer to the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vcvtusi2sh | xmm1, xmm2, r32/m32 {er}; xmm1, xmm2, r64/m64 {er} | EVEX.LLIG.F3.MAP5.W0 7B /r, EVEX.LLIG.F3.MAP5.W1 7B /r | An unsigned integer to the low half. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
Moves
| Instruction | Forms | Encoding | What it does | Set |
|---|---|---|---|---|
vmovsh | xmm1 {k1}{z}, m16; m16 {k1}, xmm1; xmm1 {k1}{z}, xmm2, xmm3 | EVEX.LLIG.F3.MAP5.W0 10 /r (load, and the register form); EVEX.LLIG.F3.MAP5.W0 11 /r (store, and the register form with the operands the other way round) | A load clears the rest of the register; the register form takes the low half of the last source and the rest from the second. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
vmovw | xmm1, r32/m16; r32/m16, xmm1 | EVEX.128.66.MAP5.WIG 6E /r; EVEX.128.66.MAP5.WIG 7E /r | Moves a word between a general register or memory and the low word of an xmm register, clearing the rest of the xmm register. AVX10.2’s forms between two xmm registers are on the AVX10 page. | AVX-512 FP16 (Intel Sapphire Rapids, 2023) |
Notes
- Element size. The tuple types count in 16-bit elements, so an 8-bit displacement is scaled by the vector size for full-vector forms and by 2 for the scalar ones (disp8×N), and broadcast reads one half. The complex multiplies work on dwords: they broadcast a dword, and their scalar forms scale by 4.
- Complex destinations. In VFMULCPH, VFCMULCPH, VFMADDCPH, VFCMADDCPH and their scalar forms the destination must not be the same register as either source; if it is, the processor raises #UD.
- Exceptions. The arithmetic raises the usual SIMD floating-point
exceptions through MXCSR.
{sae}suppresses them on the register forms that take it. The complex multiplies run as if every MXCSR exception were masked. - Vector length.
{er}and{sae}exist only on the 512-bit and scalar register forms: EVEX.b on a register form turns L′L into the rounding mode. - VMOVW and W. Intel marks VMOVW’s general-register forms WIG (W is ignored). We show W = 1 on the register form as a 64-bit register, as LLVM does; the word moved is the same.
- Compare immediates. An immediate of 0 to 31 is shown by its predicate
name (vcmpltph and so on); a larger one, whose top bits are ignored, is shown as
vcmpphwith the immediate.
Links
Reference
- Intel 64 and IA-32 Architectures Software Developer’s Manuals – Intel’s manual; volume 2 describes every instruction, FP16 among them
- AMD64 Architecture Programmer’s Manual, Volume 4 – AMD’s reference to the 128-bit, 256-bit and 512-bit media instructions
- Intel AVX512-FP16 Architecture Specification – the extension’s own specification (2021)