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 
12 typedef struct
13 {
14   char c;
15   int a[SIZE];
16 } __attribute__ ((packed)) EVAL(unaligned_array, AVX512F_LEN,);
17 
18 void
TEST(void)19 TEST (void)
20 {
21   UNION_TYPE (AVX512F_LEN, i_d) s2, res1, res3, res4;
22   EVAL(unaligned_array, AVX512F_LEN,) s1, res2, res5;
23   MASK_TYPE mask = MASK_VALUE;
24   int i, sign = 1;
25 
26   for (i = 0; i < SIZE; i++)
27     {
28       s1.a[i] = 12345 * (i + 2000) * sign;
29       s2.a[i] = 67890 * (i + 2000) * sign;
30       res3.a[i] = DEFAULT_VALUE;
31       res5.a[i] = DEFAULT_VALUE;
32       sign = -sign;
33     }
34 
35 #if AVX512F_LEN == 512
36   res1.x = _mm512_loadu_si512 (s1.a);
37   _mm512_storeu_si512 (res2.a, s2.x);
38 #endif
39   res3.x = INTRINSIC (_mask_loadu_epi32) (res3.x, mask, s1.a);
40   res4.x = INTRINSIC (_maskz_loadu_epi32) (mask, s1.a);
41   INTRINSIC (_mask_storeu_epi32) (res5.a, mask, s2.x);
42 
43 #if AVX512F_LEN == 512
44   if (UNION_CHECK (AVX512F_LEN, i_d) (res1, s1.a))
45     abort ();
46 
47   if (UNION_CHECK (AVX512F_LEN, i_d) (s2, res2.a))
48     abort ();
49 #endif
50 
51   MASK_MERGE (i_d) (s1.a, mask, SIZE);
52   if (UNION_CHECK (AVX512F_LEN, i_d) (res3, s1.a))
53     abort ();
54 
55   MASK_ZERO (i_d) (s1.a, mask, SIZE);
56   if (UNION_CHECK (AVX512F_LEN, i_d) (res4, s1.a))
57     abort ();
58 
59   MASK_MERGE (i_d) (s2.a, mask, SIZE);
60   if (UNION_CHECK (AVX512F_LEN, i_d) (s2, res5.a))
61     abort ();
62 }
63