I'm trying to use SIMD intrinsics with a C program in XCode 7.1. (Note, I am writing a C99 program and not a C++ program).
I've included immintrin.h, and I've written several functions using intrinsic commands that function very well. I'm now trying to write a function that sums the four floats in a __m128 as follows:
float cimpl_sum_m128( __m128 x ){
float out;
__m128 sum = x;
sum = _mm_hadd_ps( sum, sum );
sum = _mm_hadd_ps( sum, sum );
out = _mm_cvtss_f32( sum );
return out;
}
XCode does not recognize the _mm_cvtss_f32 command. I should note that I got the command from this website: https://software.intel.com/sites/landingpage/IntrinsicsGuide/.
Can anyone explain to me why XCode doesn't recognize this command. If I can't use _mm_cvtss_f32, how do I extract a single value from a __m128 variable?
In the future, I'd like to use _mm256_cvtss_f32; is this possible? If not, how do I extract a single value from a __m256 variable?