/ lib / numpy / distutils / checks / cpu_vxe.c
cpu_vxe.c
 1  #if (__VEC__ < 10302) || (__ARCH__ < 12)
 2      #error VXE not supported
 3  #endif
 4  
 5  #include <vecintrin.h>
 6  int main(int argc, char **argv)
 7  {
 8      __vector float x = vec_nabs(vec_xl(argc, (float*)argv));
 9      __vector float y = vec_load_len((float*)argv, (unsigned int)argc);
10      
11      x = vec_round(vec_ceil(x) + vec_floor(y));
12      __vector bool int m = vec_cmpge(x, y);
13      x = vec_sel(x, y, m);
14  
15      // need to test the existence of intrin "vflls" since vec_doublee
16      // is vec_doublee maps to wrong intrin "vfll".
17      // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100871
18  #if defined(__GNUC__) && !defined(__clang__)
19      __vector long long i = vec_signed(__builtin_s390_vflls(x));
20  #else
21      __vector long long i = vec_signed(vec_doublee(x));
22  #endif
23  
24      return (int)vec_extract(i, 0);
25  }