Fortran: Fix regression caused by r14-10477 [PR59104]
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx-cvt-2-vec.c
blobad381c07ec1eafd8bdce62870d08275ac0a57a51
1 /* { dg-do run } */
2 /* { dg-options "-O2 -ffast-math -ftree-vectorize -mavx" } */
3 /* { dg-require-effective-target avx } */
5 #ifndef CHECK_H
6 #define CHECK_H "avx-check.h"
7 #endif
9 #ifndef TEST
10 #define TEST avx_test
11 #endif
13 #include CHECK_H
15 #include "math_m_pi.h"
17 #define NUM 4
19 static void
20 __attribute__((__target__("fpmath=sse")))
21 init_src (double *src)
23 int i, sign = 1;
24 double f = rand ();
26 for (i = 0; i < NUM; i++)
28 src[i] = (i + 1) * f * M_PI * sign;
29 if (i < (NUM / 2))
31 if ((i % 6) == 0)
32 f = f * src[i];
34 else if (i == (NUM / 2))
35 f = rand ();
36 else if ((i % 6) == 0)
37 f = 1 / (f * (i + 1) * src[i] * M_PI * sign);
38 sign = -sign;
42 static void
43 __attribute__((__target__("fpmath=sse")))
44 TEST (void)
46 double a[NUM];
47 float r[NUM];
48 int i;
50 init_src (a);
52 for (i = 0; i < NUM; i++)
53 r[i] = (float) a[i];
55 /* check results: */
56 for (i = 0; i < NUM; i++)
57 if (r[i] != (float) a[i])
58 abort();