2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / avx512f-vpmuludq-2.c
blobe7e087229ee0bdea47e68d05a0109060f024b468
1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
5 #define AVX512F
7 #include "avx512f-helper.h"
9 #define SRC_SIZE (AVX512F_LEN / 32)
10 #include "avx512f-mask-type.h"
11 #define DST_SIZE (AVX512F_LEN / 64)
13 static void
14 CALC (unsigned int *s1, unsigned int *s2, unsigned long long *r)
16 int i;
18 for (i = 0; i < DST_SIZE; i++)
19 r[i] = s1[i * 2] * s2[i * 2];
22 void
23 TEST (void)
25 UNION_TYPE (AVX512F_LEN, i_ud) s1, s2;
26 UNION_TYPE (AVX512F_LEN, i_uq) res1, res2, res3;
27 MASK_TYPE mask = MASK_VALUE;
28 unsigned long long res_ref[DST_SIZE];
29 int i;
31 for (i = 0; i < SRC_SIZE; i++)
33 s1.a[i] = i * 20;
34 s2.a[i] = i + 20;
36 for (i = 0; i < DST_SIZE; i++)
37 res2.a[i] = DEFAULT_VALUE;
39 CALC (s1.a, s2.a, res_ref);
41 res1.x = INTRINSIC (_mul_epu32) (s1.x, s2.x);
42 res2.x = INTRINSIC (_mask_mul_epu32) (res2.x, mask, s1.x, s2.x);
43 res3.x = INTRINSIC (_maskz_mul_epu32) (mask, s1.x, s2.x);
45 if (UNION_CHECK (AVX512F_LEN, i_uq) (res1, res_ref))
46 abort ();
48 MASK_MERGE (i_uq) (res_ref, mask, DST_SIZE);
49 if (UNION_CHECK (AVX512F_LEN, i_uq) (res2, res_ref))
50 abort ();
52 MASK_ZERO (i_uq) (res_ref, mask, DST_SIZE);
53 if (UNION_CHECK (AVX512F_LEN, i_uq) (res3, res_ref))
54 abort ();