1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-options "-O2 -mavx" } */
4
5 #include "avx-check.h"
6
7 static __m256d
8 __attribute__((noinline))
foo(double x,int i)9 foo (double x, int i)
10 {
11 switch (i)
12 {
13 case 3:
14 return _mm256_set_pd (x, 0, 0, 0);
15 case 2:
16 return _mm256_set_pd (0, x, 0, 0);
17 case 1:
18 return _mm256_set_pd (0, 0, x, 0);
19 case 0:
20 return _mm256_set_pd (0, 0, 0, x);
21 default:
22 abort ();
23 }
24 }
25
26 static void
avx_test(void)27 avx_test (void)
28 {
29 double e = -3.234;
30 double v[4];
31 union256d u;
32 int i, j;
33
34 for (i = 0; i < ARRAY_SIZE (v); i++)
35 {
36 for (j = 0; j < ARRAY_SIZE (v); j++)
37 v[j] = 0;
38 v[i] = e;
39 u.x = foo (e, i);
40 if (check_union256d (u, v))
41 abort ();
42 }
43 }
44