| 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 / 64) |
| 11 |
#include "avx512f-mask-type.h" |
| 12 |
|
| 13 |
static void |
| 14 |
CALC (long long *s, long long *r, MASK_TYPE mask) |
| 15 |
{ |
| 16 |
int i, k; |
| 17 |
|
| 18 |
for (i = 0, k = 0; i < SIZE; i++) |
| 19 |
{ |
| 20 |
if (mask & ((long long)1 << i)) |
| 21 |
r[i] = s[k++]; |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
void |
| 26 |
TEST (void) |
| 27 |
{ |
| 28 |
UNION_TYPE (AVX512F_LEN, i_q) s1, res1, res2, res3, res4, res5, res6, res7, res8; |
| 29 |
MASK_TYPE mask = (1 << SIZE - 1) - 1; |
| 30 |
long long s2[SIZE]; |
| 31 |
long long res_ref1[SIZE]; |
| 32 |
long long 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 |
res5.a[i] = DEFAULT_VALUE; |
| 41 |
sign = -sign; |
| 42 |
} |
| 43 |
|
| 44 |
res2.x = INTRINSIC (_mask_expand_epi64) (res1.x, MASK_ALL_ONES, s1.x); |
| 45 |
res3.x = INTRINSIC (_mask_expand_epi64) (res1.x, 0, s1.x); |
| 46 |
res4.x = INTRINSIC (_mask_expand_epi64) (res1.x, mask, s1.x); |
| 47 |
res6.x = INTRINSIC (_mask_expandloadu_epi64) (res5.x, MASK_ALL_ONES, s2); |
| 48 |
res7.x = INTRINSIC (_mask_expandloadu_epi64) (res5.x, 0, s2); |
| 49 |
res8.x = INTRINSIC (_mask_expandloadu_epi64) (res5.x, mask, s2); |
| 50 |
|
| 51 |
CALC (s1.a, res_ref1, mask); |
| 52 |
CALC (s2, res_ref2, mask); |
| 53 |
|
| 54 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res2, s1.a)) |
| 55 |
abort (); |
| 56 |
|
| 57 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res1.a)) |
| 58 |
abort (); |
| 59 |
|
| 60 |
MASK_MERGE (i_q) (res_ref1, mask, SIZE); |
| 61 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res4, res_ref1)) |
| 62 |
abort (); |
| 63 |
|
| 64 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res6, s2)) |
| 65 |
abort (); |
| 66 |
|
| 67 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res7, res5.a)) |
| 68 |
abort (); |
| 69 |
|
| 70 |
MASK_MERGE (i_q) (res_ref2, mask, SIZE); |
| 71 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res8, res_ref2)) |
| 72 |
abort (); |
| 73 |
} |