Instruction
CVTSI2SD
Converts a signed 32- or 64-bit integer to double in the low element; the upper half of the destination is kept.
- Extensions
- Forms
- 4 (4 Legacy)
- Data
- Intel XED v2026.08.23
CVTSI2SD converts a signed integer of 32 or 64 bits, from a
general-purpose register or memory, to a double in the low element of an
XMM register. Every 32-bit integer has an exact double; a 64-bit one may
need more than the 53 bits of a double’s significand, and is then
rounded as MXCSR.RC says and sets the precision flag. GCC 14 and Clang
23 at -O2 compile C’s conversions from int and long to double to
it.
The false dependency
The legacy form writes bits 63:0 and keeps bits 127:64 of the destination, so the old value of that register is an input: the conversion waits for the instruction that last wrote it, although the program wants only the integer converted. AMD’s optimization guide for Zen 5 lists CVTSI2SD among the instructions whose result is merged into the upper part of the destination, and says that the processor skips that wait when it knows those bits to be zero, as after a zeroing idiom such as XORPS of a register with itself (Sections 2.11.5 and 2.11.2). Intel’s guide likewise recommends a dependency-breaking zero idiom where reusing a register creates such a chain (Section 3.5.1.7). The compilers differ in where they put one:
- GCC 14 zeroes the destination before every conversion:
pxor xmm0, xmm0, thencvtsi2sd xmm0, edi. - Clang 23 adds an XORPS before conversions inside loops, but not in a function that converts its argument once.
The VEX form, VCVTSI2SD, takes bits 127:64 from a separate source register and clears the bits above 127. In a loop, GCC zeroes one register before it and names that register as the source in every iteration; Clang names XMM15, which its code never writes.
Unsigned integers
No form converts an unsigned integer before AVX-512. For a 32-bit unsigned value both compilers zero-extend it to 64 bits and use the 64-bit form, which is exact. For a 64-bit one, GCC converts half the value, keeping its lowest bit so that the rounding comes out right, and doubles the result; Clang avoids CVTSI2SD with a sequence of packed operations. With AVX-512 both use VCVTUSI2SD. CVTSI2SS converts to a single, where 32-bit integers above 2^24 may be rounded too, and CVTDQ2PD converts two packed 32-bit integers, the form vectorized loops use.
In the optimization guide
What the optimization guide says about CVTSI2SD, a line per claim. Each links to the claim in the guide, with its sources and where they differ.
Out of order
- Partial register and flag writes: Zen 3 to Zen 5 let
sqrtss,cvtsi2sdand other scalar instructions skip the wait for an XMM register whose upper part is known to be zero, so AMD advises zeroing a vector register when done with it. - Partial register and flag writes: LLVM breaks the false dependency itself, with an
xorpsbeforecvtsi2sd,sqrtssand the other partial writers whose register was written within the last 64 instructions.
Bulldozer to Excavator
- Vectors and floating point: Scalar instructions such as SQRTSS and CVTSI2SD keep the rest of their destination and wait for its last write, unless the core knows that part to be zero, which it tracks from the instructions that cleared it.
Jaguar and Puma
- Vectors and floating point: Scalar instructions such as SQRTSS and CVTSI2SD keep the rest of their destination and so wait for its last write, unless the core knows that part to be zero: it follows registers whose upper bits an instruction cleared until something nonzero lands there.
Zen and Zen+
- Vectors and floating point: Scalar instructions such as SQRTSS or
cvtsi2sdkeep the upper part of their destination, and so wait for its last write, unless the core knows that part to be zero.
Zen 2
- Vectors and floating point: Scalar instructions such as SQRTSS or
cvtsi2sdkeep the upper part of their destination and so wait for its last write, except when the core knows that part is zero.
Zen 3
- Vectors and floating point: Scalar instructions such as SQRTSS or
cvtsi2sdkeep the upper part of their destination and so wait for its last write, except when the core knows that part is zero.
Zen 4
- Vectors and floating point: Scalar instructions such as SQRTSS or
cvtsi2sdkeep the upper part of their destination and so wait for its last write, except when the core knows that part is zero.
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.
Result double 0 is computed from r32; double 1 is that of xmm1. Result doubles 1 to 0: a1, r0.
Operation
What the forms do, in pseudocode that our tests run against results recorded on real processors. How to read.
xmm1.f64[0] = to_f64(signed(src2))
# xmm1.q[1] keeps its value
# bits 128 and up of the register are unchangedRun on AMD Zen 5 (EPYC 9645): 4 cases.
Operands
| Operand | Kind | Action |
|---|---|---|
CVTSI2SD xmm, r/m32 CVTSI2SD xmm, r/m64 | ||
xmm | explicit | read, write |
r/m32/64 | 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 CVTSI2SD, 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_cvtsi32_sd
__m128d _mm_cvtsi32_sd(__m128d __a, int __b) |
|
_mm_cvtsi64_sd
__m128d _mm_cvtsi64_sd(__m128d __a, long long __b) |
|
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-236 (CVTSI2SD)
- Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1 (253665-093, September 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, part of the LLVM Project, licensed under the Apache License 2.0 with LLVM Exceptions. The text is our own.