Instruction
CVTSD2SI
Converts the low double 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
CVTSD2SI converts the low double of an XMM register or of eight bytes of memory to a signed integer in a 32-bit or 64-bit general-purpose register, rounding as MXCSR.RC says, to the nearest even integer by default. It is the double-precision counterpart of CVTSS2SI, and CVTTSD2SI is its truncating sibling, the one C’s casts use.
Every int32 fits
A double holds every 32-bit integer exactly, so the 32-bit form can reach its full range: -2147483648.0 converts to 80000000h without setting IE, and so does any value that rounds to it. In the cases recorded on Zen 5, -2^31 in the 64-bit form gave FFFFFFFF80000000h with MXCSR unchanged, while negative infinity in the 32-bit form gave the integer indefinite, 80000000h, set IE, and cleared bits 63:32 of the register. The same bits for two different inputs mean that only IE tells a real -2^31 from an invalid conversion.
With round toward zero set in MXCSR, 2.5 converted to 2 and set PE, the inexact flag.
rint, lrint and lround
What reaches CVTSD2SI from C, with GCC 14 and Clang 23 at -O2:
lrint(x)andllrint(x)becomecvtsd2si rax, xmm0once-fno-math-errnoallows it, and calls otherwise.(int)rint(x)becomescvtsd2si eax, xmm0in Clang, even without that option, since rint never sets errno. GCC first rounds the double in an XMM register, by adding and subtracting 2^52 or with ROUNDSD under SSE4.1, and then converts with CVTTSD2SI, which gives the same result.lround(x)rounds halfway cases away from zero, which no MXCSR mode does, and stays a library call.
The EVEX form VCVTSD2SI can carry a rounding mode of its own instead of MXCSR’s, and VCVTSD2USI converts to an unsigned integer.
AMD’s Zen 5 guide lists CVTSD2SI 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 double 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.f64[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 |
|---|---|---|
CVTSD2SI r32, xmm/m64 CVTSD2SI r64, xmm/m64 | ||
r32/64 | explicit | write |
xmm/m64 | 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 CVTSD2SI, 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_cvtsd_si32
int _mm_cvtsd_si32(__m128d __a) |
|
_mm_cvtsd_si64
long long _mm_cvtsd_si64(__m128d __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 |
|---|---|---|
SSE2 | SSE2 | Every x86-64 processor in XED’s model and Zen 3 to Zen 6 |
More SSE2 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-232 (CVTSD2SI)
- 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.