| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2 -mavxifma" } */ |
| 3 |
/* { dg-require-effective-target avxifma } */ |
| 4 |
#define AVXIFMA |
| 5 |
#ifndef CHECK |
| 6 |
#define CHECK "avx-check.h" |
| 7 |
#endif |
| 8 |
|
| 9 |
#ifndef TEST |
| 10 |
#define TEST avx_test |
| 11 |
#endif |
| 12 |
|
| 13 |
#include CHECK |
| 14 |
|
| 15 |
void |
| 16 |
CALC (unsigned long long *r, unsigned long long *s1, |
| 17 |
unsigned long long *s2, unsigned long long *s3, |
| 18 |
int size) |
| 19 |
{ |
| 20 |
int i; |
| 21 |
|
| 22 |
for (i = 0; i < size; i++) |
| 23 |
{ |
| 24 |
r[i] = s2[i] * s3[i] + s1[i]; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
void |
| 29 |
TEST (void) |
| 30 |
{ |
| 31 |
union256i_q src1_256, src2_256, dst_256; |
| 32 |
union128i_q src1_128, src2_128, dst_128; |
| 33 |
unsigned long long dst_ref_256[4], dst_ref_128[2]; |
| 34 |
int i; |
| 35 |
|
| 36 |
for (i = 0; i < 4; i++) |
| 37 |
{ |
| 38 |
src1_256.a[i] = 3450 * i; |
| 39 |
src2_256.a[i] = 7863 * i; |
| 40 |
dst_256.a[i] = 117; |
| 41 |
} |
| 42 |
|
| 43 |
for (i = 0; i < 2; i++) |
| 44 |
{ |
| 45 |
src1_128.a[i] = 3540 * i; |
| 46 |
src2_128.a[i] = 7683 * i; |
| 47 |
dst_128.a[i] = 117; |
| 48 |
} |
| 49 |
|
| 50 |
CALC (dst_ref_256, dst_256.a, src1_256.a, src2_256.a, 4); |
| 51 |
dst_256.x = _mm256_madd52lo_avx_epu64 (dst_256.x, src1_256.x, src2_256.x); |
| 52 |
if (check_union256i_q (dst_256, dst_ref_256)) |
| 53 |
abort (); |
| 54 |
|
| 55 |
CALC (dst_ref_128, dst_128.a, src1_128.a, src2_128.a, 2); |
| 56 |
dst_128.x = _mm_madd52lo_avx_epu64 (dst_128.x, src1_128.x, src2_128.x); |
| 57 |
if (check_union128i_q (dst_128, dst_ref_128)) |
| 58 |
abort (); |
| 59 |
|
| 60 |
} |
| 61 |
|