1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512bw" } */
3 /* { dg-require-effective-target avx512bw } */
4 
5 #define AVX512BW
6 #include "avx512f-helper.h"
7 
8 #define SIZE (AVX512F_LEN / 16)
9 #include "avx512f-mask-type.h"
10 
11 void
CALC(MASK_TYPE * r,short * s1)12 CALC (MASK_TYPE *r, short *s1)
13 {
14   int i;
15   MASK_TYPE res = 0;
16   MASK_TYPE one = 1;
17 
18   for (i = 0; i < SIZE; i++)
19     if (s1[i] >> 15)
20       res = res | (one << i);
21 
22   *r = res;
23 }
24 
25 void
TEST(void)26 TEST (void)
27 {
28   int i, sign;
29   UNION_TYPE (AVX512F_LEN, i_w) src;
30   MASK_TYPE res, res_ref = 0;
31 
32   sign = -1;
33   for (i = 0; i < SIZE; i++)
34     {
35       src.a[i] = 2 * i * sign;
36       sign = sign * -1;
37     }
38 
39   res = INTRINSIC (_movepi16_mask) (src.x);
40 
41   CALC (&res_ref, src.a);
42 
43   if (res_ref != res)
44     abort ();
45 }
46