| 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 / 16) |
| 9 |
#include "avx512f-mask-type.h" |
| 10 |
|
| 11 |
void |
| 12 |
CALC (short *src1, short *src2, short *dst) |
| 13 |
{ |
| 14 |
int i; |
| 15 |
|
| 16 |
for (i = 0; i < SIZE; i++) |
| 17 |
dst[i] = (short) ((int) src1[i] * (int) src2[i]); |
| 18 |
} |
| 19 |
|
| 20 |
void |
| 21 |
TEST (void) |
| 22 |
{ |
| 23 |
UNION_TYPE (AVX512F_LEN, i_w) src1, src2, dst1, dst2, dst3; |
| 24 |
short dst_ref[SIZE]; |
| 25 |
MASK_TYPE mask = MASK_VALUE; |
| 26 |
int i, sign = 1; |
| 27 |
|
| 28 |
for (i = 0; i < SIZE; i++) |
| 29 |
{ |
| 30 |
src1.a[i] = i * sign; |
| 31 |
src2.a[i] = i + 20 * sign; |
| 32 |
sign = -sign; |
| 33 |
dst2.a[i] = DEFAULT_VALUE; |
| 34 |
} |
| 35 |
|
| 36 |
dst1.x = INTRINSIC (_mullo_epi16) (src1.x, src2.x); |
| 37 |
dst2.x = INTRINSIC (_mask_mullo_epi16) (dst2.x, mask, src1.x, src2.x); |
| 38 |
dst3.x = INTRINSIC (_maskz_mullo_epi16) (mask, src1.x, src2.x); |
| 39 |
|
| 40 |
CALC (src1.a, src2.a, dst_ref); |
| 41 |
|
| 42 |
if (UNION_CHECK (AVX512F_LEN, i_w) (dst1, dst_ref)) |
| 43 |
abort (); |
| 44 |
|
| 45 |
MASK_MERGE (i_w) (dst_ref, mask, SIZE); |
| 46 |
if (UNION_CHECK (AVX512F_LEN, i_w) (dst2, dst_ref)) |
| 47 |
abort (); |
| 48 |
|
| 49 |
MASK_ZERO (i_w) (dst_ref, mask, SIZE); |
| 50 |
if (UNION_CHECK (AVX512F_LEN, i_w) (dst3, dst_ref)) |
| 51 |
abort (); |
| 52 |
} |