Instruction
VROUNDPS
Rounds packed singles in an XMM or YMM register to integral values, with the rounding mode of an immediate or MXCSR.
- Extensions
- Forms
- 4 (4 VEX)
- Data
- Intel XED v2026.08.23
VROUNDPS is the VEX form of ROUNDPS, whose page
explains the immediate: bits 1:0 pick the direction, bit 2 hands it to
MXCSR.RC instead, bit 3 keeps the precision exception quiet, and the C
library’s floorf, ceilf, truncf and rintf each map to one value.
The VEX form adds a separate destination, 256 bits, memory operands at
any alignment and clearing of the bits above the result.
Bit 2 at work
The cases recorded on Zen 5 show the immediate’s bits on halves, where the directions differ most:
- 2 (up) gave 1, -0, 2, 3 and -2 for 0.5, -0.5, 1.5, 2.5 and -2.5;
- 8 (to nearest, inexact suppressed) gave 2, 2 and -2 for 1.5, 2.5 and -2.5, ties going to the even neighbour;
- 0Dh asks for rounding down in bits 1:0, but its bit 2 defers to MXCSR, which was set to round toward zero: -2.5 became -2, not -3, and 0.5 became 0.
No EVEX form
AVX-512 did not give VROUNDPS an EVEX encoding; it rounds with
VRNDSCALEPS, whose immediate has the same low four
bits and whose upper four bits, when zero, round to a whole number just
as VROUNDPS does. So a compiler that targets AVX-512 picks by register:
Clang 23 at -O2 vectorizes a loop over floorf to VROUNDPS with
immediate 9 on ymm registers for -march=x86-64-v3 and also for
x86-64-v4, where it works on ymm, and to VRNDSCALEPS on zmm registers
for znver5. GCC 14 keeps that loop scalar unless
-fno-trapping-math is given; with it, it emits VROUNDPS on ymm
registers for x86-64-v3 and VRNDSCALEPS on zmm for x86-64-v4. Being
VEX-only, VROUNDPS cannot reach registers 16 to 31 either.
AMD’s Zen 5 guide lists VROUNDPS, and VRNDSCALEPS at every width, as one macro-op with a latency of 3 cycles.
Forms
| Instruction | Encoding | Requires |
|---|---|---|
VROUNDPS xmm, m128, imm8
VROUNDPS_XMMdq_MEMdq_IMMb | VEX.128.66.0F3A.WIG 08 /r ib | AVX |
VROUNDPS xmm, xmm, imm8
VROUNDPS_XMMdq_XMMdq_IMMb | VEX.128.66.0F3A.WIG 08 /r ib | AVX |
VROUNDPS ymm, m256, imm8
VROUNDPS_YMMqq_MEMqq_IMMb | VEX.256.66.0F3A.WIG 08 /r ib | AVX |
VROUNDPS ymm, ymm, imm8
VROUNDPS_YMMqq_YMMqq_IMMb | VEX.256.66.0F3A.WIG 08 /r ib | AVX |
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.
Every single works alike: 4 and 8 singles in the xmm and ymm forms.
Result single i comes from single i of xmm2. Result singles 3 to 0: r3, r2, r1, r0.
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):
ymm1.f32[i] = round(src2.f32[i], imm8)
# imm8[1:0]: rn, rd, ru, rz; bit 2: MXCSR.RC; bit 3: no PE
# ymm1 is zeroed from bit VL upRun on AMD Zen 5 (EPYC 9645): 24 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
VROUNDPS xmm, xmm/m128, imm8 VROUNDPS ymm, ymm/m256, imm8 | ||
xmm, ymm | explicit | write |
xmm/m128, ymm/m256 | explicit | read |
imm8 | 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.
- All forms
avx-type-2
Attributes
What else XED records about the forms. How to read.
- All forms
- follows MXCSR
Intrinsics
The C intrinsics of Clang 23.1.2 that compile to VROUNDPS, 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_ceil_ps
__m128 _mm_ceil_ps(__m128 X) |
|
_mm_floor_ps
__m128 _mm_floor_ps(__m128 X) |
|
_mm_round_ps
__m128 _mm_round_ps(__m128 X, const int M) |
|
_mm_roundscale_ps
__m128 _mm_roundscale_ps(__m128 A, const int imm) |
|
_mm256_ceil_ps
__m256 _mm256_ceil_ps(__m256 V) |
|
_mm256_floor_ps
__m256 _mm256_floor_ps(__m256 V) |
|
_mm256_round_ps
__m256 _mm256_round_ps(__m256 V, const int M) |
|
_mm256_roundscale_ps
__m256 _mm256_roundscale_ps(__m256 A, const int imm) |
|
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.
| ISA set | CPUID | Processors |
|---|---|---|
AVX | AVX | Sandy Bridge, Ivy Bridge, Haswell, Broadwell, Skylake, Comet Lake, Cannon Lake, Ice Lake (client), Tiger Lake, Alder Lake, Arrow Lake, Panther Lake, Nova Lake, Skylake-SP, Cascade Lake, Cooper Lake, Ice Lake (server), Sapphire Rapids, Emerald Rapids, Granite Rapids, Diamond Rapids, Sierra Forest, Clearwater Forest, Knights Landing, Knights Mill, Bulldozer, Piledriver, Zen, Zen+, Zen 2, Zen 3, Zen 4, Zen 5, Zen 6 |
More AVX instructions
- VPSUBD
- VPSUBQ
- VPSUBSB
- VPSUBSW
- VPSUBUSB
- VPSUBUSW
- VPSUBW
- VPTEST
- VPUNPCKHBW
- VPUNPCKHDQ
- VPUNPCKHQDQ
- VPUNPCKHWD
- VPUNPCKLBW
- VPUNPCKLDQ
- VPUNPCKLQDQ
- VPUNPCKLWD
- VPXOR
- VRCPPS
- VRCPSS
- VROUNDPD
- VROUNDSD
- VROUNDSS
- VRSQRTPS
- VRSQRTSS
- VSHUFPD
- VSHUFPS
- VSQRTPD
- VSQRTPS
- VSQRTSD
- VSQRTSS
- VSTMXCSR
- VSUBPD
- VSUBPS
- VSUBSD
- VSUBSS
- VTESTPD
- VTESTPS
- VUCOMISD
- VUCOMISS
- VUNPCKHPD
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. - Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 2 (325383-093, September 2026): Volume 2B, page 4-586 (ROUNDPS)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 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, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.