_mm_castpd_ps
Microsoft Specific
Applies a type cast to reinterpret two 64-bit floating point values passed in as a 128-bit parameter as packed 32-bit floating point values.
__m128 _mm_castpd_ps( __m128d a );
// _mm_castpd_ps.cpp
#include <stdio.h>
#include <emmintrin.h>
int main () {
__m128d a;
a.m128d_f64[1] = 0.00125;
a.m128d_f64[0] = 2;
__m128 res = _mm_castpd_ps( a );
printf_s("Original a: %8f %8f\n",
a.m128d_f64[1], a.m128d_f64[0]);
printf_s("Result res: %8f %8f %8f %8f\n",
res.m128_f32[3], res.m128_f32[2],
res.m128_f32[1], res.m128_f32[0]);
__m128d newA = _mm_castps_pd( res );
printf_s("New a: %8f %8f\n",
newA.m128d_f64[1], newA.m128d_f64[0]);
return 0;
}
Original a: 0.001250 2.000000 Result res: 0.830000 89128.960938 2.000000 0.000000 New a: 0.001250 2.000000