1 /* { dg-do run } */ 2 /* { dg-options "-O2 -ffast-math -ftree-vectorize -mavx512f" } */ 3 /* { dg-require-effective-target avx512f } */ 4 5 #define __NO_MATH_INLINES 6 #include "math_m_pi.h" 7 #include "avx512f-check.h" 8 9 extern double floor (double); 10 11 #define NUM 64 12 13 static void 14 __attribute__((__target__("fpmath=sse"))) init_src(double * src)15init_src (double *src) 16 { 17 int i, sign = 1; 18 double f = rand (); 19 20 for (i = 0; i < NUM; i++) 21 { 22 src[i] = (i + 1) * f * M_PI * sign; 23 if (i < (NUM / 2)) 24 { 25 if ((i % 6) == 0) 26 f = f * src[i]; 27 } 28 else if (i == (NUM / 2)) 29 f = rand (); 30 else if ((i % 6) == 0) 31 f = 1 / (f * (i + 1) * src[i] * M_PI * sign); 32 sign = -sign; 33 } 34 } 35 36 static void 37 __attribute__((__target__("fpmath=387"))) avx512f_test(void)38avx512f_test (void) 39 { 40 double a[NUM]; 41 int r[NUM]; 42 int i; 43 44 init_src (a); 45 46 for (i = 0; i < NUM; i++) 47 r[i] = (int) floor (a[i]); 48 49 /* check results: */ 50 for (i = 0; i < NUM; i++) 51 if (r[i] != (int) floor (a[i])) 52 abort(); 53 } 54