1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
4
5 #define AVX512F
6
7 #include "avx512f-helper.h"
8
9 #define SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
11 #include "string.h"
12
13 static void
CALC(UNION_TYPE (AVX512F_LEN,i_d)s1,int * res_ref,int mask)14 CALC (UNION_TYPE (AVX512F_LEN, i_d) s1, int *res_ref, int mask)
15 {
16 memset (res_ref, 0, 16);
17 memcpy (res_ref, s1.a + mask * 4, 16);
18 }
19
20 void
TEST(void)21 TEST (void)
22 {
23 UNION_TYPE (AVX512F_LEN, i_d) s1;
24 union128i_d res1, res2, res3;
25 int res_ref[4];
26 MASK_TYPE mask = MASK_VALUE;
27 int j;
28
29 for (j = 0; j < SIZE; j++)
30 {
31 s1.a[j] = j * j / 4.56;
32 }
33
34 for (j = 0; j < 4; j++)
35 {
36 res1.a[j] = DEFAULT_VALUE;
37 res2.a[j] = DEFAULT_VALUE;
38 res3.a[j] = DEFAULT_VALUE;
39 }
40
41 res1.x = INTRINSIC (_extracti32x4_epi32) (s1.x, 1);
42 res2.x =
43 INTRINSIC (_mask_extracti32x4_epi32) (res2.x, mask, s1.x, 1);
44 res3.x = INTRINSIC (_maskz_extracti32x4_epi32) (mask, s1.x, 1);
45 CALC (s1, res_ref, 1);
46
47 if (check_union128i_d (res1, res_ref))
48 abort ();
49
50 MASK_MERGE (i_d) (res_ref, mask, 4);
51 if (check_union128i_d (res2, res_ref))
52 abort ();
53
54 MASK_ZERO (i_d) (res_ref, mask, 4);
55 if (check_union128i_d (res3, res_ref))
56 abort ();
57 }
58