Conversion Operations (SSE2)

Microsoft Specific

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, _mm_cvttsd_si32, and _mm_cvttps_epi32 intrinsics use the truncate rounding mode regardless of the mode specified by the MXCSR register.

The conversion-operation intrinsics are listed in the following table, followed by detailed descriptions.

SSE2 intrinsics use the __m128, __m128i, and __m128d data types, which are not supported on Itanium Processor Family (IPF) processors. Any SSE2 intrinsics that use the __m64 data type are not supported on x64 processors.

The emmintrin.h header file contains the declarations for the SSE2 instructions intrinsics.

Conversion Operations

Intrinsic name

Corresponding instruction

Return type

Parameters

_mm_cvtpd_ps

CVTPD2PS

__m128

(__m128d a)

_mm_cvtps_pd

CVTPS2PD

__m128d

(__m128 a)

_mm_cvtepi32_pd

CVTDQ2PD

__m128d

(__m128i a)

_mm_cvtpd_epi32

CVTPD2DQ

__m128i

(__m128d a)

_mm_cvtsd_si32

CVTSD2SI

int

(__m128d a)

_mm_cvtsd_ss

CVTSD2SS

__m128

(__m128 a, __m128d b)

_mm_cvtsi32_sd

CVTSI2SD

__m128d

(__m128d a, int b)

_mm_cvtss_sd

CVTSS2SD

__m128d

(__m128d a, __m128 b)

_mm_cvttpd_epi32

CVTTPD2DQ

__m128i

(__m128d a)

_mm_cvttsd_si32

CVTTSD2SI

int

(__m128d a)

_mm_cvtepi32_ps

CVTDQ2PS

__m128

(__m128i a)

_mm_cvtps_epi32

CVTPS2DQ

__m128i

(__m128 a)

_mm_cvttps_epi32

CVTTPS2DQ

__m128i

(__m128 a)

_mm_cvtpd_pi32

CVTPD2PI

__m64

(__m128d a)

_mm_cvttpd_pi32

CVTTPD2PI

__m64

(__m128d a)

_mm_cvtpi32_pd

CVTPI2PD

__m128d

(__m64 a)

For an explanation of the syntax used in code samples in this topic, see Floating-Point Intrinsics Using Streaming SIMD Extensions.

See Also

Concepts

Floating-Point Intrinsics Using Streaming SIMD Extensions 2 Instructions