Instruction
CVTSS2SI
Converts the low single to a signed 32- or 64-bit integer in a general-purpose register, rounding as MXCSR says.
- Extensions
- Forms
- 4 (4 Legacy)
- Data
- Intel XED v2026.08.23
CVTSS2SI converts the low single of an XMM register or of four bytes of memory to a signed integer in a 32-bit or 64-bit general-purpose register, rounding as MXCSR.RC says. Under the default, round to nearest, a value halfway between two integers goes to the even one: 2.5 becomes 2, 3.5 becomes 4 and -0.5 becomes 0. Its sibling CVTTSS2SI always truncates, which is what a C cast asks for; that page also covers what both do with values out of range.
Rounding as the mode says
C’s functions for rounding in the current mode are the ones that map
here. With -fno-math-errno, GCC 14 and Clang 23 at -O2 compile
lrintf(x) to cvtss2si rax, xmm0, even when the result is then
narrowed to an int, since lrintf returns a long; without that
option both call the library, as lrintf may set errno. lroundf,
which rounds halfway cases away from zero, matches no MXCSR mode and
stays a call.
To round another way for one conversion, legacy code changes MXCSR with LDMXCSR around it, which affects every later instruction too. The EVEX form VCVTSS2SI can carry its own rounding mode in the instruction instead, with exceptions suppressed; VCVTSS2USI converts to an unsigned integer.
Recorded on Zen 5
- With round toward zero in MXCSR, 1.0000001 converted to 1 and set PE, the inexact flag.
- A single too large for 32 bits, 5EFFFFFFh (about 9.2 * 10^18), converted to 80000000h in a 32-bit register and negative infinity to 8000000000000000h in a 64-bit one, the integer indefinite of each size, and both set IE. A 32-bit destination cleared bits 63:32 of the register, as any 32-bit write does.
CVTSD2SI is the version for doubles. AMD’s Zen 5 guide lists CVTSS2SI as two macro-ops, and gives its EVEX form a latency of four cycles.
Forms
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.
r32 receives the conversion of single 0 of xmm2: r0.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
a = src2.f32[0]
dest.write(cvt_int(a, dest.bits)) # r32: bits 63:32 cleared
Run on AMD Zen 5 (EPYC 9645): 4 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
CVTSS2SI r32, xmm/m32 CVTSS2SI r64, xmm/m32 | ||
r32/64 | explicit | write |
xmm/m32 | 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
SSE_TYPE_3
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 CVTSS2SI, 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_cvt_ss2si
int _mm_cvt_ss2si(__m128 __a) |
|
_mm_cvtss_si32
int _mm_cvtss_si32(__m128 __a) |
|
_mm_cvtss_si64
long long _mm_cvtss_si64(__m128 __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.
| ISA set | CPUID | Processors |
|---|---|---|
SSE | SSE | Every x86-64 processor in XED’s model and Zen 3 to Zen 6 |
More SSE instructions
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 2A, page 3-242 (CVTSS2SI)
- 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.