| 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 / 64) |
| 10 |
#include "avx512f-mask-type.h" |
| 11 |
|
| 12 |
static void |
| 13 |
CALC (double *s, double *r, MASK_TYPE mask) |
| 14 |
{ |
| 15 |
int i, k; |
| 16 |
|
| 17 |
for (i = 0, k = 0; i < SIZE; i++) |
| 18 |
{ |
| 19 |
if (mask & (1 << i)) |
| 20 |
r[i] = s[k++]; |
| 21 |
} |
| 22 |
} |
| 23 |
|
| 24 |
void |
| 25 |
TEST (void) |
| 26 |
{ |
| 27 |
UNION_TYPE (AVX512F_LEN, d) s1, res2, res3, res4, res5, res6, res7, res8, res9; |
| 28 |
MASK_TYPE mask = (1 << SIZE - 1) - 1; |
| 29 |
double s2[SIZE]; |
| 30 |
double res_ref1[SIZE]; |
| 31 |
double res_ref2[SIZE]; |
| 32 |
int i, sign = 1; |
| 33 |
|
| 34 |
for (i = 0; i < SIZE; i++) |
| 35 |
{ |
| 36 |
s1.a[i] = 123.456 * (i + 200) * sign; |
| 37 |
s2[i] = 789.012 * (i + 300) * sign; |
| 38 |
res2.a[i] = DEFAULT_VALUE; |
| 39 |
res6.a[i] = DEFAULT_VALUE; |
| 40 |
sign = -sign; |
| 41 |
} |
| 42 |
|
| 43 |
res3.x = INTRINSIC (_mask_expand_pd) (res2.x, MASK_ALL_ONES, s1.x); |
| 44 |
res4.x = INTRINSIC (_mask_expand_pd) (res2.x, 0, s1.x); |
| 45 |
res5.x = INTRINSIC (_mask_expand_pd) (res2.x, mask, s1.x); |
| 46 |
|
| 47 |
res7.x = INTRINSIC (_mask_expandloadu_pd) (res6.x, MASK_ALL_ONES, s2); |
| 48 |
res8.x = INTRINSIC (_mask_expandloadu_pd) (res6.x, 0, s2); |
| 49 |
res9.x = INTRINSIC (_mask_expandloadu_pd) (res6.x, mask, s2); |
| 50 |
|
| 51 |
|
| 52 |
/* no mask is the same as all ones mask. */ |
| 53 |
CALC (s1.a, res_ref1, mask); |
| 54 |
CALC (s2, res_ref2, mask); |
| 55 |
|
| 56 |
if (UNION_CHECK (AVX512F_LEN, d) (res3, s1.a)) |
| 57 |
abort (); |
| 58 |
|
| 59 |
if (UNION_CHECK (AVX512F_LEN, d) (res4, res2.a)) |
| 60 |
abort (); |
| 61 |
|
| 62 |
MASK_MERGE (d) (res_ref1, mask, SIZE); |
| 63 |
if (UNION_CHECK (AVX512F_LEN, d) (res5, res_ref1)) |
| 64 |
abort (); |
| 65 |
|
| 66 |
if (UNION_CHECK (AVX512F_LEN, d) (res7, s2)) |
| 67 |
abort (); |
| 68 |
|
| 69 |
if (UNION_CHECK (AVX512F_LEN, d) (res8, res6.a)) |
| 70 |
abort (); |
| 71 |
|
| 72 |
MASK_MERGE (d) (res_ref2, mask, SIZE); |
| 73 |
if (UNION_CHECK (AVX512F_LEN, d) (res9, res_ref2)) |
| 74 |
abort (); |
| 75 |
|
| 76 |
} |