Each conversion intrinsic takes one data type and performs a conversion to a different type. Some conversions such as _mm_cvtpd_ps result in a loss of precision. The rounding mode used in such cases is determined by the value in the MXCSR register. The default rounding mode is round-to-nearest. Note that the rounding mode used by the C and C++ languages when performing a type conversion is to truncate. The _mm_cvttpd_epi32 and _mm_cvttsd_si32 intrinsics use the truncate rounding mode regardless of the mode specified by the MXCSR register.
The conversion-operation intrinsics for Streaming SIMD Extensions 2 (SSE2) are listed in the following table followed by detailed descriptions.
For detailed information about an intrinsic, click on that intrinsic name in the following table.
The results of each intrinsic operation are placed in registers. The information about what is placed in each register appears in the tables below, in the detailed explanation of each intrinsic. R, R0, R1, R2 and R3 represent the registers in which results are placed.
The prototypes for SSE2 intrinsics are in the emmintrin.h header file.
Intrinsic Name |
Operation | Corresponding SSE2 Instruction |
---|---|---|
_mm_cvtpd_ps | Convert DP FP to SP FP | CVTPD2PS |
_mm_cvtps_pd | Convert from SP FP to DP FP | CVTPS2PD |
_mm_cvtepi32_pd | Convert lower integer values to DP FP | CVTDQ2PD |
_mm_cvtpd_epi32 | Convert DP FP values to integer values | CVTPD2DQ |
_mm_cvtsd_si32 | Convert lower DP FP value to integer value | CVTSD2SI |
_mm_cvtsd_ss | Convert lower DP FP value to SP FP | CVTSD2SS |
_mm_cvtsi32_sd | Convert signed integer value to DP FP | CVTSI2SD |
_mm_cvtss_sd | Convert lower SP FP value to DP FP | CVTSS2SD |
_mm_cvttpd_epi32 | Convert DP FP values to signed integers | CVTTPD2DQ |
_mm_cvttsd_si32 | Convert lower DP FP to signed integer | CVTTSD2SI |
_mm_cvtpd_pi32 | Convert two DP FP values to signed integer values | CVTPD2PI |
_mm_cvttpd_pi32 | Convert two DP FP values to signed integer values using truncate | CVTTPD2PI |
_mm_cvtpi32_pd | Convert two signed integer values to DP FP | CVTPI2PD |
_mm_cvtsd_f64 | Extract DP FP value from first vector element | None |
__m128 _mm_cvtpd_ps(__m128d a)
Converts the two DP FP values of a to SP FP values.
R0 | R1 | R2 | R3 |
---|---|---|---|
(float) a0 | (float) a1 | 0.0 | 0.0 |
__m128d _mm_cvtps_pd(__m128 a)
Converts the lower two SP FP values of a to DP FP values.
R0 | R1 |
---|---|
(double) a0 | (double) a1 |
__m128d _mm_cvtepi32_pd(__m128i a)
Converts the lower two signed 32-bit integer values of a to DP FP values.
R0 | R1 |
---|---|
(double) a0 | (double) a1 |
__m128i _mm_cvtpd_epi32(__m128d a)
Converts the two DP FP values of a to 32-bit signed integer values.
R0 | R1 | R2 | R3 |
---|---|---|---|
(int) a0 | (int) a1 | 0x0 | 0x0 |
int _mm_cvtsd_si32(__m128d a)
Converts the lower DP FP value of a to a 32-bit signed integer value.
R |
---|
(int) a0 |
__m128 _mm_cvtsd_ss(__m128 a, __m128d b)
Converts the lower DP FP value of b to an SP FP value. The upper SP FP values in a are passed through.
R0 | R1 | R2 | R3 |
---|---|---|---|
(float) b0 | a1 | a2 | a3 |
__m128d _mm_cvtsi32_sd(__m128d a, int b)
Converts the signed integer value in b to a DP FP value. The upper DP FP value in a is passed through.
R0 | R1 |
---|---|
(double) b | a1 |
__m128d _mm_cvtss_sd(__m128d a, __m128 b)
Converts the lower SP FP value of b to a DP FP value. The upper value DP FP value in a is passed through.
R0 | R1 |
---|---|
(double) b0 | a1 |
__m128i _mm_cvttpd_epi32(__m128d a)
Converts the two DP FP values of a to 32-bit signed integers using truncate.
R0 | R1 | R2 |
R3 |
---|---|---|---|
(int) a0 | (int) a1 | 0x0 |
0x0 |
int _mm_cvttsd_si32(__m128d a)
Converts the lower DP FP value of a to a 32-bit signed integer using truncate.
R |
---|
(int) a0 |
__m64 _mm_cvtpd_pi32(__m128d a)
Converts the two DP FP values of a to 32-bit signed integer values.
R0 | R1 |
---|---|
(int)a0 | (int) a1 |
__m64 _mm_cvttpd_pi32(__m128d a)
Converts the two DP FP values of a to 32-bit signed integer values using truncate.
R0 | R1 |
---|---|
(int)a0 | (int) a1 |
__m128d _mm_cvtpi32_pd(__m64 a)
Converts the two 32-bit signed integer values of a to DP FP values.
R0 | R1 |
---|---|
(double)a0 | (double)a1 |
_mm_cvtsd_f64(__m128d a)
This intrinsic extracts a double precision floating point value from the first vector element of an __m128d. It does so in the most efficient manner possible in the context used. This intrinsic does not map to any specific SSE2 instruction.