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#define ALIGN ((AVX512F_LEN) / 8)
12
13void
14TEST (void)
15{
16  UNION_TYPE (AVX512F_LEN, i_d) s2, s3, res1, res2, res5, res6, res7, res8;
17  MASK_TYPE mask = MASK_VALUE;
18  int s1[SIZE] __attribute__ ((aligned (ALIGN)));
19  int res3[SIZE] __attribute__ ((aligned (ALIGN)));
20  int res4[SIZE] __attribute__ ((aligned (ALIGN)));
21  int res9[SIZE] __attribute__ ((aligned (ALIGN)));
22  int i, sign = 1;
23
24  for (i = 0; i < SIZE; i++)
25    {
26      s1[i] = 1234 * (i + 2000) * sign;
27      s2.a[i] = 5678 * (i - 30) * sign;
28      s3.a[i] = 9012 * (i + 40) * sign;
29      res5.a[i] = DEFAULT_VALUE;
30      res7.a[i] = DEFAULT_VALUE;
31      res9[i] = DEFAULT_VALUE;
32      sign = -sign;
33    }
34
35#if AVX512F_LEN == 512
36  res1.x = INTRINSIC (_load_si512) (s1);
37  res2.x = INTRINSIC (_load_epi32) (s1);
38  INTRINSIC (_store_si512) (res3, s2.x);
39  INTRINSIC (_store_epi32) (res4, s2.x);
40#endif
41  res5.x = INTRINSIC (_mask_mov_epi32) (res5.x, mask, s3.x);
42  res6.x = INTRINSIC (_maskz_mov_epi32) (mask, s3.x);
43  res7.x = INTRINSIC (_mask_load_epi32) (res7.x, mask, s1);
44  res8.x = INTRINSIC (_maskz_load_epi32) (mask, s1);
45  INTRINSIC (_mask_store_epi32) (res9, mask, s2.x);
46
47#if AVX512F_LEN == 512
48  if (UNION_CHECK (AVX512F_LEN, i_d) (res1, s1))
49    abort ();
50
51  if (UNION_CHECK (AVX512F_LEN, i_d) (res2, s1))
52    abort ();
53
54  if (UNION_CHECK (AVX512F_LEN, i_d) (s2, res3))
55    abort ();
56
57  if (UNION_CHECK (AVX512F_LEN, i_d) (s2, res4))
58    abort ();
59#endif
60
61  MASK_MERGE (i_d) (s3.a, mask, SIZE);
62  if (checkVi (res5.a, s3.a, SIZE))
63    abort ();
64
65  MASK_ZERO (i_d) (s3.a, mask, SIZE);
66  if (checkVi (res6.a, s3.a, SIZE))
67    abort ();
68
69  MASK_MERGE (i_d) (s1, mask, SIZE);
70  if (UNION_CHECK (AVX512F_LEN, i_d) (res7, s1))
71    abort ();
72
73  MASK_ZERO (i_d) (s1, mask, SIZE);
74  if (UNION_CHECK (AVX512F_LEN, i_d) (res8, s1))
75    abort ();
76
77  MASK_MERGE (i_d) (s2.a, mask, SIZE);
78  if (UNION_CHECK (AVX512F_LEN, i_d) (s2, res9))
79    abort ();
80}
81