| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -mavx512bw" } */ |
| 3 |
/* { dg-require-effective-target avx512bw } */ |
| 4 |
|
| 5 |
#define AVX512BW |
| 6 |
#include "avx512f-helper.h" |
| 7 |
|
| 8 |
#define SIZE (AVX512F_LEN / 8) |
| 9 |
#include "avx512f-mask-type.h" |
| 10 |
|
| 11 |
void |
| 12 |
CALC (char *s1, char *s2, char *r) |
| 13 |
{ |
| 14 |
int i; |
| 15 |
|
| 16 |
for (i = 0; i < SIZE; i++) |
| 17 |
{ |
| 18 |
if (s2[i] < 0) |
| 19 |
r[i] = 0; |
| 20 |
else |
| 21 |
r[i] = s1[(s2[i] & 0xf) + 16 * (i / 16)]; |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
void |
| 26 |
TEST (void) |
| 27 |
{ |
| 28 |
UNION_TYPE (AVX512F_LEN, i_b) s1, s2, res1, res2, res3; |
| 29 |
char res_ref[SIZE]; |
| 30 |
int i, sign = 1; |
| 31 |
MASK_TYPE mask = MASK_VALUE; |
| 32 |
|
| 33 |
for (i = 0; i < SIZE; i++) |
| 34 |
{ |
| 35 |
s1.a[i] = i * i * sign; |
| 36 |
s2.a[i] = 179 - i; |
| 37 |
res1.a[i] = DEFAULT_VALUE; |
| 38 |
res2.a[i] = DEFAULT_VALUE; |
| 39 |
res3.a[i] = DEFAULT_VALUE; |
| 40 |
sign = -sign; |
| 41 |
} |
| 42 |
|
| 43 |
res1.x = INTRINSIC (_shuffle_epi8) (s1.x, s2.x); |
| 44 |
res2.x = INTRINSIC (_mask_shuffle_epi8) (res2.x, mask, s1.x, s2.x); |
| 45 |
res3.x = INTRINSIC (_maskz_shuffle_epi8) (mask, s1.x, s2.x); |
| 46 |
|
| 47 |
CALC (s1.a, s2.a, res_ref); |
| 48 |
|
| 49 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res1, res_ref)) |
| 50 |
abort (); |
| 51 |
|
| 52 |
MASK_MERGE (i_b) (res_ref, mask, SIZE); |
| 53 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res2, res_ref)) |
| 54 |
abort (); |
| 55 |
|
| 56 |
MASK_ZERO (i_b) (res_ref, mask, SIZE); |
| 57 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res3, res_ref)) |
| 58 |
abort (); |
| 59 |
} |