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
12static void
13CALC (int *r, int *s1, int *s2)
14{
15  int i;
16  for (i = 0; i < SIZE / 4; i++)
17    {
18      r[4 * i] = s1[4 * i];
19      r[4 * i + 1] = s2[4 * i];
20      r[4 * i + 2] = s1[4 * i + 1];
21      r[4 * i + 3] = s2[4 * i + 1];
22    }
23}
24
25void
26TEST (void)
27{
28  int i, sign;
29  UNION_TYPE (AVX512F_LEN, i_d) res1, res2, res3, src1, src2;
30  MASK_TYPE mask = MASK_VALUE;
31  int res_ref[SIZE];
32
33  sign = -1;
34  for (i = 0; i < SIZE; i++)
35    {
36      src1.a[i] = 34 * i * sign;
37      src1.a[i] = 179 * i;
38      sign = sign * -1;
39    }
40  for (i = 0; i < SIZE; i++)
41    res2.a[i] = DEFAULT_VALUE;
42
43  res1.x = INTRINSIC (_unpacklo_epi32) (src1.x, src2.x);
44  res2.x =
45    INTRINSIC (_mask_unpacklo_epi32) (res2.x, mask, src1.x, src2.x);
46  res3.x = INTRINSIC (_maskz_unpacklo_epi32) (mask, src1.x, src2.x);
47
48  CALC (res_ref, src1.a, src2.a);
49
50  if (UNION_CHECK (AVX512F_LEN, i_d) (res1, res_ref))
51    abort ();
52
53  MASK_MERGE (i_d) (res_ref, mask, SIZE);
54  if (UNION_CHECK (AVX512F_LEN, i_d) (res2, res_ref))
55    abort ();
56
57  MASK_ZERO (i_d) (res_ref, mask, SIZE);
58  if (UNION_CHECK (AVX512F_LEN, i_d) (res3, res_ref))
59    abort ();
60}
61