Hey everyone
I'm testing some intrinsics and checking some results. Unfortunately, I don't understand why when I'm trying to evaluate a[i] > 2, I get "-nan" as an output for the true cases. Maybe I did something wrong but I thought this should return 1 when it's true and 0 when it's false. I looked other internet for this error but I didn't find anything.
Here's my code:
#include <iostream> #include <immintrin.h> using namespace std; void print( double *A, int N ) { for( int i(0); i<N; ++i ) cout << A[i] << "\t" ; cout << endl; } int main( void ) { int align = 64; int N = 4; double *A = (double*)_mm_malloc(N*sizeof(double), align); __m256d *a =(__m256d*)A; for( int i(0); i<N; ++i ) A[i] = i + 1 ; print( A, N ); __m256d _2_ = _mm256_set1_pd( 2. ); a[0] = _mm256_cmp_pd( a[0], _2_, _CMP_GT_OQ ); print( A, N ); _mm_free( A ); return 0; }
And the output:
1 2 3 4
0 0 -nan -nan
My configuration:
Intel(R) Xeon(R) E5-2650 v2
icpc version 14.0.2
Any ideas?
Guillaume,