PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vinserti64x4-2.c
blob58993ad5ed0c23388ced64bb68284e26c74ca9f9
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx512f } */
3 /* { dg-options "-O2 -mavx512f" } */
5 #define SIZE (512 / 64)
6 #include "avx512f-mask-type.h"
7 #include <string.h>
8 #include "avx512f-check.h"
9 #include "avx512f-mask-type.h"
10 #include "avx512f-helper.h"
12 void static
13 avx512f_test (void)
15 union512i_q s1, res, res2, res3;
16 union256i_q s2;
17 long long int res_ref[8];
18 MASK_TYPE mask = MASK_VALUE;
19 int j;
21 for (j = 0; j < 8; j++)
23 s1.a[j] = j * j;
24 res2.a[j] = DEFAULT_VALUE;
27 for (j = 0; j < 4; j++)
28 s2.a[j] = j * j * j;
30 res.x = _mm512_inserti64x4 (s1.x, s2.x, 0);
31 res2.x = _mm512_mask_inserti64x4 (res2.x, mask, s1.x, s2.x, 0);
32 res3.x = _mm512_maskz_inserti64x4 (mask, s1.x, s2.x, 0);
34 memcpy (res_ref, s1.a, 64);
35 memcpy (res_ref, s2.a, 32);
37 if (check_union512i_q (res, res_ref))
38 abort ();
40 MASK_MERGE (i_q) (res_ref, mask, SIZE);
41 if (check_union512i_q (res2, res_ref))
42 abort ();
44 MASK_ZERO (i_q) (res_ref, mask, SIZE);
45 if (check_union512i_q (res3, res_ref))
46 abort ();
48 res.x = _mm512_inserti64x4 (s1.x, s2.x, 1);
49 res2.x = _mm512_mask_inserti64x4 (res2.x, mask, s1.x, s2.x, 1);
50 res3.x = _mm512_maskz_inserti64x4 (mask, s1.x, s2.x, 1);
52 memcpy (res_ref, s1.a, 64);
53 memcpy (res_ref + 4, s2.a, 32);
55 if (check_union512i_q (res, res_ref))
56 abort ();
58 MASK_MERGE (i_q) (res_ref, mask, SIZE);
59 if (check_union512i_q (res2, res_ref))
60 abort ();
62 MASK_ZERO (i_q) (res_ref, mask, SIZE);
63 if (check_union512i_q (res3, res_ref))
64 abort ();