| 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 |
|
| 10 |
#define SIZE (AVX512F_LEN / 64) |
| 11 |
#include "avx512f-mask-type.h" |
| 12 |
|
| 13 |
static void |
| 14 |
CALC (long long *mask, long long *src1, long long *dst) |
| 15 |
{ |
| 16 |
int i; |
| 17 |
|
| 18 |
for (i = 0; i < SIZE; i++) |
| 19 |
{ |
| 20 |
#if AVX512F_LEN == 512 |
| 21 |
dst[i] = src1[mask[i] & 7]; |
| 22 |
#else |
| 23 |
dst[i] = src1[mask[i] & 3]; |
| 24 |
#endif |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
void |
| 29 |
TEST (void) |
| 30 |
{ |
| 31 |
UNION_TYPE (AVX512F_LEN, i_q) res1, res2, res3, src1, src2; |
| 32 |
MASK_TYPE mask = MASK_VALUE; |
| 33 |
long long res_ref[SIZE]; |
| 34 |
int i, sign = 1; |
| 35 |
|
| 36 |
for (i = 0; i < SIZE; i++) |
| 37 |
{ |
| 38 |
src1.a[i] = (i + 10) * (i + 10) * sign; |
| 39 |
src2.a[i] = 2 * i + 10; |
| 40 |
sign = -sign; |
| 41 |
res3.a[i] = DEFAULT_VALUE; |
| 42 |
} |
| 43 |
|
| 44 |
res1.x = INTRINSIC (_permutexvar_epi64) (src1.x, src2.x); |
| 45 |
res2.x = INTRINSIC (_maskz_permutexvar_epi64) (mask, src1.x, src2.x); |
| 46 |
res3.x = INTRINSIC (_mask_permutexvar_epi64) (res3.x, mask, src1.x, src2.x); |
| 47 |
|
| 48 |
CALC (src1.a, src2.a, res_ref); |
| 49 |
|
| 50 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref)) |
| 51 |
abort (); |
| 52 |
|
| 53 |
MASK_ZERO (i_q) (res_ref, mask, SIZE); |
| 54 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref)) |
| 55 |
abort (); |
| 56 |
|
| 57 |
MASK_MERGE (i_q) (res_ref, mask, SIZE); |
| 58 |
if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res_ref)) |
| 59 |
abort (); |
| 60 |
} |