| 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 *r, char *s) |
| 13 |
{ |
| 14 |
int i; |
| 15 |
for (i = 0; i < SIZE; i++) |
| 16 |
{ |
| 17 |
r[i] = s[0]; |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
TEST (void) |
| 23 |
{ |
| 24 |
int i, sign; |
| 25 |
UNION_TYPE (AVX512F_LEN, i_b) res1, res2, res3; |
| 26 |
UNION_TYPE (128, i_b) src; |
| 27 |
MASK_TYPE mask = SIZE | 123; |
| 28 |
char res_ref[SIZE]; |
| 29 |
|
| 30 |
sign = -1; |
| 31 |
for (i = 0; i < 16; i++) |
| 32 |
{ |
| 33 |
src.a[i] = 1 + 3 * i * sign; |
| 34 |
sign = sign * -1; |
| 35 |
} |
| 36 |
for (i = 0; i < SIZE; i++) |
| 37 |
res2.a[i] = DEFAULT_VALUE; |
| 38 |
|
| 39 |
CALC (res_ref, src.a); |
| 40 |
|
| 41 |
if (AVX512F_LEN == 512) |
| 42 |
{ |
| 43 |
res1.x = INTRINSIC (_broadcastb_epi8) (src.x); |
| 44 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res1, res_ref)) |
| 45 |
abort (); |
| 46 |
} |
| 47 |
|
| 48 |
res2.x = INTRINSIC (_mask_broadcastb_epi8) (res2.x, mask, src.x); |
| 49 |
res3.x = INTRINSIC (_maskz_broadcastb_epi8) (mask, src.x); |
| 50 |
|
| 51 |
MASK_MERGE (i_b) (res_ref, mask, SIZE); |
| 52 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res2, res_ref)) |
| 53 |
abort (); |
| 54 |
|
| 55 |
MASK_ZERO (i_b) (res_ref, mask, SIZE); |
| 56 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res3, res_ref)) |
| 57 |
abort (); |
| 58 |
|
| 59 |
CALC (res_ref, src.a); |
| 60 |
|
| 61 |
if (AVX512F_LEN == 512) |
| 62 |
{ |
| 63 |
res1.x = INTRINSIC (_set1_epi8) (src.a[0]); |
| 64 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res1, res_ref)) |
| 65 |
abort (); |
| 66 |
} |
| 67 |
|
| 68 |
res2.x = INTRINSIC (_mask_set1_epi8) (res2.x, mask, src.a[0]); |
| 69 |
res3.x = INTRINSIC (_maskz_set1_epi8) (mask, src.a[0]); |
| 70 |
|
| 71 |
MASK_MERGE (i_b) (res_ref, mask, SIZE); |
| 72 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res2, res_ref)) |
| 73 |
abort (); |
| 74 |
|
| 75 |
MASK_ZERO (i_b) (res_ref, mask, SIZE); |
| 76 |
if (UNION_CHECK (AVX512F_LEN, i_b) (res3, res_ref)) |
| 77 |
abort (); |
| 78 |
} |