2015-12-10 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx-set-v8si-5.c
blob456e87772994334d9fb6c31bee5423289c878edc
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-options "-O2 -mavx" } */
5 #include "avx-check.h"
7 static __m256i
8 __attribute__((noinline))
9 foo (int x, int i)
11 switch (i)
13 case 7:
14 return _mm256_set_epi32 (x, 1, 1, 1, 1, 1, 1, 1);
15 case 6:
16 return _mm256_set_epi32 (1, x, 1, 1, 1, 1, 1, 1);
17 case 5:
18 return _mm256_set_epi32 (1, 1, x, 1, 1, 1, 1, 1);
19 case 4:
20 return _mm256_set_epi32 (1, 1, 1, x, 1, 1, 1, 1);
21 case 3:
22 return _mm256_set_epi32 (1, 1, 1, 1, x, 1, 1, 1);
23 case 2:
24 return _mm256_set_epi32 (1, 1, 1, 1, 1, x, 1, 1);
25 case 1:
26 return _mm256_set_epi32 (1, 1, 1, 1, 1, 1, x, 1);
27 case 0:
28 return _mm256_set_epi32 (1, 1, 1, 1, 1, 1, 1, x);
29 default:
30 abort ();
34 static void
35 avx_test (void)
37 int e = 0xabadbeef;
38 int v[8];
39 union256i_d u;
40 int i, j;
42 for (i = 0; i < ARRAY_SIZE (v); i++)
44 for (j = 0; j < ARRAY_SIZE (v); j++)
45 v[j] = 1;
46 v[i] = e;
47 u.x = foo (e, i);
48 if (check_union256i_d (u, v))
49 abort ();