2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512ifma-vpmaddluq-2.c
blobce38bebe335dda9462d8c179065d29b9afb457e9
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512ifma" } */
3 /* { dg-require-effective-target avx512ifma } */
5 #define AVX512IFMA
7 #include "avx512f-helper.h"
9 #define SIZE (AVX512F_LEN / 64)
10 #include "avx512f-mask-type.h"
12 void
13 CALC (unsigned long long *r, unsigned long long *s1,
14 unsigned long long *s2, unsigned long long *s3)
16 int i;
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];
23 void
24 TEST (void)
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;
31 for (i = 0; i < SIZE; i++)
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;
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);
45 if (UNION_CHECK (AVX512F_LEN, i_q) (dst1, dst_ref))
46 abort ();
48 MASK_MERGE (i_q) (dst_ref, mask, SIZE);
49 if (UNION_CHECK (AVX512F_LEN, i_q) (dst2, dst_ref))
50 abort ();
52 MASK_ZERO (i_q) (dst_ref, mask, SIZE);
53 if (UNION_CHECK (AVX512F_LEN, i_q) (dst3, dst_ref))
54 abort ();