Instruction
VCVTPH2PS
Converts packed half-precision values to singles, which is exact.
VCVTPH2PS widens half-precision values (IEEE 754’s binary16: a sign, 5 exponent bits and 10 fraction bits) to singles: four from the low 64 bits of an XMM register or from memory, or eight into a YMM register. Every half, denormals included, has an exact single, so nothing is rounded and the result never depends on MXCSR.RC. It came with F16C (CPUID.01H:ECX[29]), which has only this conversion and VCVTPS2PH back: on such processors halves are a storage format, widened before any arithmetic. Intel’s optimization manual weighs the memory and bandwidth such data saves against the cost of converting it (Section 15.14).
Denormals and NaNs
Intel’s and AMD’s manuals both say that a denormal half converts to its normal single value with MXCSR.DAZ ignored and no denormal exception. AMD’s exception table for the instruction nonetheless lists the denormal flag, with overflow, underflow and precision. The cases recorded on Zen 5 follow the text: with DAZ set, the smallest denormal half 0001h became 2^-24 (33800000h), and no flag but IE was set. IE came from a signaling NaN, which the conversion makes quiet, keeping its payload in the top bits of the single’s.
In compiled code
GCC 14 and Clang 23 at -O2 with -mf16c convert a _Float16 to float
with VCVTPH2PS on the register; GCC first clears the rest of it with
VPBLENDW, so the conversion sees zeros in the other elements. A loop
widening an array of halves becomes the YMM form with a memory operand
in Clang, as in the manual’s example (Example 15-33), while GCC
converts one element at a time, inserting each half with VPINSRW.
Adding two _Float16 values widens both, adds them with VADDSS and
narrows the sum with VCVTPS2PH.
The EVEX forms (AVX-512F or AVX10.1) widen sixteen halves into a ZMM
register, with masking and {sae}; VCVTPH2PSX of
AVX512-FP16 adds broadcast. The instruction table of AMD’s Zen 5 guide
gives the XMM form one macro-op with a latency of three cycles, and the
YMM form from a register two macro-ops and four cycles.
In the optimization guide
What the optimization guide says about VCVTPH2PS, a line per claim. Each links to the claim in the guide, with its sources and where they differ.
Crestmont and Gracemont
- Vectors and AVX2: The 256-bit forms that widen or insert data loaded from memory take two dependent micro-ops.
Zen and Zen+
- Vectors and floating point: Carry-less multiplication with PCLMULQDQ and the half-precision conversions VCVTPH2PS and VCVTPS2PH are microcoded, in AMD’s spreadsheet and in LLVM’s model.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
VCVTPH2PS xmm, m64
VCVTPH2PS_XMMdq_MEMq | VEX.128.66.0F38.W0 13 /r | F16C |
VCVTPH2PS xmm, xmm
VCVTPH2PS_XMMdq_XMMq | VEX.128.66.0F38.W0 13 /r | F16C |
VCVTPH2PS ymm, m128
VCVTPH2PS_YMMqq_MEMdq | VEX.256.66.0F38.W0 13 /r | F16C |
VCVTPH2PS ymm, xmm
VCVTPH2PS_YMMqq_XMMdq | VEX.256.66.0F38.W0 13 /r | F16C |
VCVTPH2PS zmm {k}{z}, ymm, {sae}
VCVTPH2PS_ZMMf32_MASKmskw_YMMf16_AVX512 | EVEX.512.66.0F38.W0 13 /r | AVX10.1 or AVX512F |
VCVTPH2PS zmm {k}{z}, m256
VCVTPH2PS_ZMMf32_MASKmskw_MEMf16_AVX512 | EVEX.512.66.0F38.W0 13 /r | AVX10.1 or AVX512F |
VCVTPH2PS xmm {k}{z}, xmm
VCVTPH2PS_XMMf32_MASKmskw_XMMf16_AVX512 | EVEX.128.66.0F38.W0 13 /r | AVX10.1 or AVX512F + AVX512VL |
VCVTPH2PS xmm {k}{z}, m64
VCVTPH2PS_XMMf32_MASKmskw_MEMf16_AVX512 | EVEX.128.66.0F38.W0 13 /r | AVX10.1 or AVX512F + AVX512VL |
VCVTPH2PS ymm {k}{z}, xmm
VCVTPH2PS_YMMf32_MASKmskw_XMMf16_AVX512 | EVEX.256.66.0F38.W0 13 /r | AVX10.1 or AVX512F + AVX512VL |
VCVTPH2PS ymm {k}{z}, m128
VCVTPH2PS_YMMf32_MASKmskw_MEMf16_AVX512 | EVEX.256.66.0F38.W0 13 /r | AVX10.1 or AVX512F + AVX512VL |
Latency and throughput
| Model | xmm, m64 | xmm, xmmxmm {k}{z}, xmmno mask | ymm, m128 | ymm, xmmymm {k}{z}, xmmno mask | zmm {k}{z}, ymm, {sae}no mask, with {sae} | zmm {k}{z}, ymm, {sae}with a mask, zeroing | zmm {k}{z}, m256no mask | zmm {k}{z}, m256with a mask, zeroing | xmm {k}{z}, xmmwith a mask, zeroing | xmm {k}{z}, m64no mask | xmm {k}{z}, m64with a mask, zeroing | ymm {k}{z}, xmmwith a mask, zeroing | ymm {k}{z}, m128no mask | ymm {k}{z}, m128with a mask, zeroing |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sandy Bridge | 8 / 1p0 | 3 / 1p05 | 8 / 1p05 | 3 / 1p05 | ||||||||||
| Haswell | 6 / 1p1 | 2 / 1p15 | 7 / 1p1 | 2 / 1p15 | ||||||||||
| Broadwell | 6 / 1p1 | 2 / 1p15 | 6 / 1p1 | 2 / 1p15 | ||||||||||
| Skylake | 9 / 0.5p01 | 5 / 1p015 | 10 / 0.5p01 | 7 / 1p015 | ||||||||||
| Skylake-SP, Ice Lake | 9 / 0.5p01 | 5 / 1p015 | 10 / 0.5p01 | 7 / 1p015 | 7 / 1p05 | 7 / 1p05 | 11 / 0.5p01 | 11 / 0.5p01 | 5 / 1p015 | 10 / 0.5p01 | 10 / 0.5p01 | 7 / 1p015 | 11 / 0.5p01 | 11 / 0.5p01 |
| Alder Lake | 12 / 0.5p01 | 6 / 1p015 | 12 / 0.5p01 | 8 / 1p015 | ||||||||||
| Sapphire Rapids | 12 / 0.5p01 | 6 / 1p015 | 12 / 0.5p01 | 8 / 1p015 | 8 / 1p05 | 11 / 1p05 | 13 / 1p05 | 16 / 1p05 | 9 / 1p015 | 12 / 0.5p01 | 14 / 0.5p01 | 11 / 1p015 | 12 / 0.5p01 | 14 / 0.5p01 |
| Lunar Lake | 12 / 0.5V0 V1 | 5 / 0.5V0 V1 V2 V3 | 11 / 2.33V0 V1 | 7 / 2V0 V1 V2 V3 | ||||||||||
| Piledriver | 13 / 2FPCVT FPU0 | 8 / 2FPCVT FPSTO FPU0 | 13 / 2FPCVT FPU0 | 8 / 2FPCVT FPSTO FPU0 | ||||||||||
| Zen, Zen 2 | 100 / 0.25 | 100 / 0.25 | 100 / 0.25 | 100 / 0.25 | ||||||||||
| Zen 3 | 10 / 0.5FP2 FP3 | 3 / 0.5FP2 FP3 | 11 / 1FP2 FP3 | 4 / 1FP2 FP3 | ||||||||||
| Zen 4 | 10 / 0.5FP2 FP3 | 3 / 0.5FP2 FP3 | 11 / 1FP2 FP3 | 4 / 1FP2 FP3 | 4 / 21FP2 FP3 | 4 / 21FP2 FP3 | 11 / 2FP2 FP3 | 11 / 2FP2 FP3 | 3 / 0.5FP2 FP3 | 10 / 0.5FP2 FP3 | 10 / 0.5FP2 FP3 | 4 / 12FP2 FP3 | 11 / 1FP2 FP3 | 11 / 1FP2 FP3 |
| Jaguar | 8 / 1FPU1 | 3 / 1FPU1 STC | 8 / 2FPU1 | 3 / 2FPU1 STC | ||||||||||
Data flow
Where the elements of the sources go, element 0 on the right; results that depend on a control value are drawn for an example. How to read.
Shown for the zmm form; the xmm and ymm forms work the same on 4 and 8 halves. The EVEX forms write under a mask: where its bit is 0, the element keeps its old value, or zeroes it with {z}.
Result singles 15 to 0: a15, unchanged (bit 14 of k1 is 0), a13, a12, a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
for i in range(VL // 32):
if k1[i]: # 1 without a write mask
a = src2.f16[i]
zmm1.f32[i] = to_f32_f16c(a)
elif zeroing:
zmm1.f32[i] = 0
# else: zmm1.f32[i] keeps its value
# {sae}: no exception flags
# zmm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 15 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
VCVTPH2PS xmm, xmm/m64 VCVTPH2PS ymm, xmm/m128 | ||
xmm, ymm | explicit | write |
xmm/m64/128 | explicit | read |
VCVTPH2PS xmm {k}{z}, xmm/m64 VCVTPH2PS ymm {k}{z}, xmm/m128 VCVTPH2PS zmm {k}{z}, ymm/m256, {sae} | ||
xmm, ymm, zmm | explicit | write (masked) |
{k} | explicit | read (write mask) |
xmm/m64, xmm/m128, ymm/m256 | explicit | read |
Flags
None: XED records no flag that the forms test or change.
Exceptions
The exception class is XED's name for the set of exception conditions that a form follows. How to read.
- VEX forms
avx-type-11- EVEX forms
AVX512-E11
Attributes
What else XED records about the forms. How to read.
- All forms
- follows MXCSR
- EVEX forms
- write masking
- EVEX memory forms
- memory fault suppression
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to VCVTPH2PS, each with the form it compiles to and the Clang options it needs. The forms come from compiling every intrinsic and decoding the result with Intel XED; all intrinsics A–Z explains the method.
| Intrinsic | Compiles to |
|---|---|
_mm_cvtph_ps
__m128 _mm_cvtph_ps(__m128i __a) |
|
_mm_mask_cvtph_ps
__m128 _mm_mask_cvtph_ps(__m128 __W, __mmask8 __U, __m128i __A) |
|
_mm_maskz_cvtph_ps
__m128 _mm_maskz_cvtph_ps(__mmask8 __U, __m128i __A) |
|
_mm256_cvtph_ps
__m256 _mm256_cvtph_ps(__m128i __a) |
|
_mm256_mask_cvtph_ps
__m256 _mm256_mask_cvtph_ps(__m256 __W, __mmask8 __U, __m128i __A) |
|
_mm256_maskz_cvtph_ps
__m256 _mm256_maskz_cvtph_ps(__mmask8 __U, __m128i __A) |
|
_mm512_cvt_roundph_ps
__m512 _mm512_cvt_roundph_ps(__m256i A, const int R) |
|
_mm512_cvtph_ps
__m512 _mm512_cvtph_ps(__m256i __A) |
|
_mm512_mask_cvt_roundph_ps
__m512 _mm512_mask_cvt_roundph_ps(__m512 W, __mmask16 U, __m256i A, const int R) |
|
_mm512_mask_cvtph_ps
__m512 _mm512_mask_cvtph_ps(__m512 __W, __mmask16 __U, __m256i __A) |
|
_mm512_maskz_cvt_roundph_ps
__m512 _mm512_maskz_cvt_roundph_ps(__mmask16 U, __m256i A, const int R) |
|
_mm512_maskz_cvtph_ps
__m512 _mm512_maskz_cvtph_ps(__mmask16 __U, __m256i __A) |
|
CPUID and processors
Each form belongs to an XED ISA set. A form can be used when the processor reports every CPUID bit of one of its ISA set's alternatives.
More F16C instructions
More AVX10.1 instructions
- VCMPSH
- VCMPSS
- VCOMISD
- VCOMISH
- VCOMISS
- VCOMPRESSPD
- VCOMPRESSPS
- VCVTDQ2PD
- VCVTDQ2PH
- VCVTDQ2PS
- VCVTNE2PS2BF16
- VCVTNEPS2BF16
- VCVTPD2DQ
- VCVTPD2PH
- VCVTPD2PS
- VCVTPD2QQ
- VCVTPD2UDQ
- VCVTPD2UQQ
- VCVTPH2DQ
- VCVTPH2PD
- VCVTPH2PSX
- VCVTPH2QQ
- VCVTPH2UDQ
- VCVTPH2UQQ
- VCVTPH2UW
- VCVTPH2W
- VCVTPS2DQ
- VCVTPS2PD
- VCVTPS2PH
- VCVTPS2PHX
- VCVTPS2QQ
- VCVTPS2UDQ
- VCVTPS2UQQ
- VCVTQQ2PD
- VCVTQQ2PH
- VCVTQQ2PS
- VCVTSD2SH
- VCVTSD2SI
- VCVTSD2SS
- VCVTSD2USI
Sources
- Intel XED v2026.08.23 (commit
0bcb6237345c): forms, encodings, operands, flags, exception classes, attributes, ISA sets, CPUID bits and chip model. - The CPU data of x86-64.net: Zen 3 to Zen 6, from GCC’s
-marchfeature sets and AMD’s Processor Programming References, which the page of each processor cites. - Clang's x86 intrinsic headers, LLVM 23.1.2 (commit
85ac56026243): the intrinsics, their signatures and doc comments, and the Clang of that release, which compiled each of them. - LLVM 23.1.2's x86 scheduling models (commit
85ac56026243): the latency, reciprocal throughput and ports of each form, as llvm-mca reports them. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2C, page 5-54 (VCVTPH2PS/
VCVTPH2PSX) - Intel Advanced Vector Extensions 10.2 Architecture Specification, revision 7.0 (361050-007, April 2026)
- AMD64 Architecture Programmer's Manual, Volume 4: 128-Bit, 256-Bit, and 512-Bit Media Instructions (26568, rev. 3.27, July 2026)
- Intel 64 and IA-32 Architectures Optimization Reference Manual, Volume 1 (248966-051, October 2026)
- Software Optimization Guide for the AMD Zen5 Microarchitecture (58455, rev. 1.00, August 2024), Wayback Machine copy of AMD's ZIP
The tables are derived from Intel XED, Copyright Intel Corporation, licensed under the Apache License 2.0; x86-64.net converted and reformatted them. The intrinsics and their signatures come from Clang and the timings from LLVM's scheduling models, both part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.