Initial support for AVX-512{VL,BW,DQ}
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512bw-vpmovw2m-2.c
blob1c8ae02beb2650814d9abd76853b1b58b1121ed1
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512bw -DAVX512BW" } */
3 /* { dg-require-effective-target avx512bw } */
5 #include "avx512f-helper.h"
7 #define SIZE (AVX512F_LEN / 16)
8 #include "avx512f-mask-type.h"
10 CALC (MASK_TYPE *r, short *s1)
12 int i;
13 MASK_TYPE res = 0;
14 MASK_TYPE one = 1;
16 for (i = 0; i < SIZE; i++)
17 if (s1[i] >> 15)
18 res = res | (one << i);
20 *r = res;
23 void
24 TEST (void)
26 int i, sign;
27 UNION_TYPE (AVX512F_LEN, i_w) src;
28 MASK_TYPE res, res_ref = 0;
30 sign = -1;
31 for (i = 0; i < SIZE; i++)
33 src.a[i] = 2 * i * sign;
34 sign = sign * -1;
37 res = INTRINSIC (_movepi16_mask) (src.x);
39 CALC (&res_ref, src.a);
41 if (res_ref != res)
42 abort ();