| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -mavx512ifma" } */ |
| 3 |
/* { dg-require-effective-target avx512ifma } */ |
| 4 |
|
| 5 |
#define AVX512IFMA |
| 6 |
|
| 7 |
#include "avx512f-helper.h" |
| 8 |
|
| 9 |
#define SIZE (AVX512F_LEN / 64) |
| 10 |
#include "avx512f-mask-type.h" |
| 11 |
|
| 12 |
void |
| 13 |
CALC (unsigned long long *r, unsigned long long *s1, |
| 14 |
unsigned long long *s2, unsigned long long *s3) |
| 15 |
{ |
| 16 |
int i; |
| 17 |
|
| 18 |
/* Valid, because values are less than 1 << 26. */ |
| 19 |
for (i = 0; i < SIZE; i++) |
| 20 |
r[i] = s2[i] * s3[i] + s1[i]; |
| 21 |
} |
| 22 |
|
| 23 |
void |
| 24 |
TEST (void) |
| 25 |
{ |
| 26 |
UNION_TYPE (AVX512F_LEN, i_q) src1, src2, dst1, dst2, dst3; |
| 27 |
unsigned long long dst_ref[SIZE]; |
| 28 |
int i; |
| 29 |
MASK_TYPE mask = MASK_VALUE; |
| 30 |
|
| 31 |
for (i = 0; i < SIZE; i++) |
| 32 |
{ |
| 33 |
src1.a[i] = i + 50; |
| 34 |
src2.a[i] = i + 100; |
| 35 |
dst1.a[i] = DEFAULT_VALUE; |
| 36 |
dst2.a[i] = DEFAULT_VALUE; |
| 37 |
dst3.a[i] = DEFAULT_VALUE; |
| 38 |
} |
| 39 |
|
| 40 |
CALC (dst_ref, dst1.a, src1.a, src2.a); |
| 41 |
dst1.x = INTRINSIC (_madd52lo_epu64) (dst1.x, src1.x, src2.x); |
| 42 |
dst2.x = INTRINSIC (_mask_madd52lo_epu64) (dst2.x, mask, src1.x, src2.x); |
| 43 |
dst3.x = INTRINSIC (_maskz_madd52lo_epu64) (mask, dst3.x, src1.x, src2.x); |
| 44 |
|
| 45 |
if (UNION_CHECK (AVX512F_LEN, i_q) (dst1, dst_ref)) |
| 46 |
abort (); |
| 47 |
|
| 48 |
MASK_MERGE (i_q) (dst_ref, mask, SIZE); |
| 49 |
if (UNION_CHECK (AVX512F_LEN, i_q) (dst2, dst_ref)) |
| 50 |
abort (); |
| 51 |
|
| 52 |
MASK_ZERO (i_q) (dst_ref, mask, SIZE); |
| 53 |
if (UNION_CHECK (AVX512F_LEN, i_q) (dst3, dst_ref)) |
| 54 |
abort (); |
| 55 |
} |