| 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; |
| 28 |
MASK_TYPE mask = MASK_VALUE; |
| 29 |
double s2[SIZE]; |
| 30 |
double res_ref1[SIZE]; |
| 31 |
double res_ref2[SIZE]; |
| 32 |
double res_ref3[SIZE]; |
| 33 |
int i, sign = 1; |
| 34 |
|
| 35 |
for (i = 0; i < SIZE; i++) |
| 36 |
{ |
| 37 |
s1.a[i] = 123.456 * (i + 200) * sign; |
| 38 |
s2[i] = 789.012 * (i + 300) * sign; |
| 39 |
res2.a[i] = DEFAULT_VALUE; |
| 40 |
res4.a[i] = DEFAULT_VALUE; |
| 41 |
sign = -sign; |
| 42 |
} |
| 43 |
|
| 44 |
res2.x = INTRINSIC (_mask_expand_pd) (res2.x, mask, s1.x); |
| 45 |
res3.x = INTRINSIC (_maskz_expand_pd) (mask, s1.x); |
| 46 |
res4.x = INTRINSIC (_mask_expandloadu_pd) (res4.x, mask, s2); |
| 47 |
res5.x = INTRINSIC (_maskz_expandloadu_pd) (mask, s2); |
| 48 |
|
| 49 |
/* no mask is the same as all ones mask. */ |
| 50 |
CALC (s1.a, res_ref1, MASK_ALL_ONES); |
| 51 |
CALC (s1.a, res_ref2, mask); |
| 52 |
CALC (s2, res_ref3, mask); |
| 53 |
|
| 54 |
MASK_MERGE (d) (res_ref2, mask, SIZE); |
| 55 |
if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref2)) |
| 56 |
abort (); |
| 57 |
|
| 58 |
MASK_ZERO (d) (res_ref2, mask, SIZE); |
| 59 |
if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref2)) |
| 60 |
abort (); |
| 61 |
|
| 62 |
MASK_MERGE (d) (res_ref3, mask, SIZE); |
| 63 |
if (UNION_CHECK (AVX512F_LEN, d) (res4, res_ref3)) |
| 64 |
abort (); |
| 65 |
|
| 66 |
MASK_ZERO (d) (res_ref3, mask, SIZE); |
| 67 |
if (UNION_CHECK (AVX512F_LEN, d) (res5, res_ref3)) |
| 68 |
abort (); |
| 69 |
} |