PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-set-v8di-4.c
blobea6421fcc035d4bd103fdc180c38107a2a927010
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #include "avx512f-check.h"
7 static __m512i
8 __attribute__ ((noinline))
9 foo (long long x, int i)
11 switch (i)
13 case 7:
14 return _mm512_set_epi64 (x, 0, 0, 0, 0, 0, 0, 0);
15 case 6:
16 return _mm512_set_epi64 (0, x, 0, 0, 0, 0, 0, 0);
17 case 5:
18 return _mm512_set_epi64 (0, 0, x, 0, 0, 0, 0, 0);
19 case 4:
20 return _mm512_set_epi64 (0, 0, 0, x, 0, 0, 0, 0);
21 case 3:
22 return _mm512_set_epi64 (0, 0, 0, 0, x, 0, 0, 0);
23 case 2:
24 return _mm512_set_epi64 (0, 0, 0, 0, 0, x, 0, 0);
25 case 1:
26 return _mm512_set_epi64 (0, 0, 0, 0, 0, 0, x, 0);
27 case 0:
28 return _mm512_set_epi64 (0, 0, 0, 0, 0, 0, 0, x);
29 default:
30 abort ();
34 static __m512i
35 __attribute__ ((noinline))
36 foo_r (long long x, int i)
38 switch (i)
40 case 0:
41 return _mm512_setr_epi64 (x, 0, 0, 0, 0, 0, 0, 0);
42 case 1:
43 return _mm512_setr_epi64 (0, x, 0, 0, 0, 0, 0, 0);
44 case 2:
45 return _mm512_setr_epi64 (0, 0, x, 0, 0, 0, 0, 0);
46 case 3:
47 return _mm512_setr_epi64 (0, 0, 0, x, 0, 0, 0, 0);
48 case 4:
49 return _mm512_setr_epi64 (0, 0, 0, 0, x, 0, 0, 0);
50 case 5:
51 return _mm512_setr_epi64 (0, 0, 0, 0, 0, x, 0, 0);
52 case 6:
53 return _mm512_setr_epi64 (0, 0, 0, 0, 0, 0, x, 0);
54 case 7:
55 return _mm512_setr_epi64 (0, 0, 0, 0, 0, 0, 0, x);
56 default:
57 abort ();
61 static void
62 avx512f_test (void)
64 long long e = 0xabadbeef01234567LL;
65 long long v[8];
66 union512i_q res;
67 int i, j;
69 for (i = 0; i < 8; i++)
71 for (j = 0; j < 8; j++)
72 v[j] = 0;
73 v[i] = e;
75 res.x = foo (e, i);
77 if (check_union512i_q (res, v))
78 abort ();
80 res.x = _mm512_setzero_si512 ();
82 res.x = foo_r (e, i);
84 if (check_union512i_q (res, v))
85 abort ();