| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -mavx512vbmi2" } */ |
| 3 |
/* { dg-require-effective-target avx512vbmi2 } */ |
| 4 |
|
| 5 |
#define AVX512F |
| 6 |
|
| 7 |
#define AVX512VBMI2 |
| 8 |
#include "avx512f-helper.h" |
| 9 |
|
| 10 |
#define SIZE (AVX512F_LEN / 16) |
| 11 |
#include "avx512f-mask-type.h" |
| 12 |
|
| 13 |
static void |
| 14 |
CALC (short *s, short *r, MASK_TYPE mask) |
| 15 |
{ |
| 16 |
int i, k; |
| 17 |
|
| 18 |
for (i = 0, k = 0; i < SIZE; i++) |
| 19 |
{ |
| 20 |
if (mask & (1 << i)) |
| 21 |
r[i] = s[k++]; |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
void |
| 26 |
TEST (void) |
| 27 |
{ |
| 28 |
UNION_TYPE (AVX512F_LEN, i_w) s1, res1, res2, res3, res4; |
| 29 |
MASK_TYPE mask = MASK_VALUE; |
| 30 |
short s2[SIZE]; |
| 31 |
short res_ref1[SIZE]; |
| 32 |
short res_ref2[SIZE]; |
| 33 |
int i, sign = 1; |
| 34 |
|
| 35 |
for (i = 0; i < SIZE; i++) |
| 36 |
{ |
| 37 |
s1.a[i] = 12345 * (i + 200) * sign; |
| 38 |
s2[i] = 67890 * (i + 300) * sign; |
| 39 |
res1.a[i] = DEFAULT_VALUE; |
| 40 |
res3.a[i] = DEFAULT_VALUE; |
| 41 |
sign = -sign; |
| 42 |
} |
| 43 |
|
| 44 |
res1.x = INTRINSIC (_mask_expand_epi16) (res1.x, mask, s1.x); |
| 45 |
res2.x = INTRINSIC (_maskz_expand_epi16) (mask, s1.x); |
| 46 |
res3.x = INTRINSIC (_mask_expandloadu_epi16) (res3.x, mask, s2); |
| 47 |
res4.x = INTRINSIC (_maskz_expandloadu_epi16) (mask, s2); |
| 48 |
|
| 49 |
CALC (s1.a, res_ref1, mask); |
| 50 |
CALC (s2, res_ref2, mask); |
| 51 |
|
| 52 |
MASK_MERGE (i_w) (res_ref1, mask, SIZE); |
| 53 |
if (UNION_CHECK (AVX512F_LEN, i_w) (res1, res_ref1)) |
| 54 |
abort (); |
| 55 |
|
| 56 |
MASK_ZERO (i_w) (res_ref1, mask, SIZE); |
| 57 |
if (UNION_CHECK (AVX512F_LEN, i_w) (res2, res_ref1)) |
| 58 |
abort (); |
| 59 |
|
| 60 |
MASK_MERGE (i_w) (res_ref2, mask, SIZE); |
| 61 |
if (UNION_CHECK (AVX512F_LEN, i_w) (res3, res_ref2)) |
| 62 |
abort (); |
| 63 |
|
| 64 |
MASK_ZERO (i_w) (res_ref2, mask, SIZE); |
| 65 |
if (UNION_CHECK (AVX512F_LEN, i_w) (res4, res_ref2)) |
| 66 |
abort (); |
| 67 |
} |