PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-floorf-sfix-vec-1.c
blob6a25f438a8e794d2b224d1b33e1793cf7776f92f
1 /* { dg-do run } */
2 /* { dg-options "-O2 -ffast-math -ftree-vectorize -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
4 /* { dg-skip-if "no M_PI" { vxworks_kernel } } */
6 #define __NO_MATH_INLINES
7 #include <math.h>
8 #include "avx512f-check.h"
10 #define NUM 64
12 static void
13 __attribute__((__target__("fpmath=sse")))
14 init_src (float *src)
16 int i, sign = 1;
17 float f = rand ();
19 for (i = 0; i < NUM; i++)
21 src[i] = (i + 1) * f * M_PI * sign;
22 if (i < (NUM / 2))
24 if ((i % 6) == 0)
25 f = f * src[i];
27 else if (i == (NUM / 2))
28 f = rand ();
29 else if ((i % 6) == 0)
30 f = 1 / (f * (i + 1) * src[i] * M_PI * sign);
31 sign = -sign;
35 static void
36 __attribute__((__target__("fpmath=387")))
37 avx512f_test (void)
39 float a[NUM];
40 int r[NUM];
41 int i;
43 init_src (a);
45 for (i = 0; i < NUM; i++)
46 r[i] = (int) floorf (a[i]);
48 /* check results: */
49 for (i = 0; i < NUM; i++)
50 if (r[i] != (int) floorf (a[i]))
51 abort();