1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512dq" } */
3 /* { dg-require-effective-target avx512dq } */
4 
5 #define AVX512DQ
6 #include "avx512f-helper.h"
7 
8 #define SIZE (AVX512F_LEN / 64)
9 #include "avx512f-mask-type.h"
10 
11 void
CALC(double * s,unsigned long long * r)12 CALC (double *s, unsigned long long *r)
13 {
14   int i;
15 
16   for (i = 0; i < SIZE; i++)
17     {
18       r[i] = (unsigned long long) (s[i] + 0.5);
19     }
20 }
21 
22 void
TEST(void)23 TEST (void)
24 {
25   UNION_TYPE (AVX512F_LEN, d) s;
26   UNION_TYPE (AVX512F_LEN, i_q) res1, res2, res3;
27   MASK_TYPE mask = MASK_VALUE;
28   unsigned long long res_ref[SIZE];
29   int i;
30 
31   for (i = 0; i < SIZE; i++)
32     {
33       s.a[i] = 123.456 * (i + 2000);
34       res2.a[i] = DEFAULT_VALUE;
35     }
36 
37   res1.x = INTRINSIC (_cvtpd_epu64) (s.x);
38   res2.x = INTRINSIC (_mask_cvtpd_epu64) (res2.x, mask, s.x);
39   res3.x = INTRINSIC (_maskz_cvtpd_epu64) (mask, s.x);
40 
41   CALC (s.a, res_ref);
42 
43   if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref))
44     abort ();
45 
46   MASK_MERGE (i_q) (res_ref, mask, SIZE);
47   if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref))
48     abort ();
49 
50   MASK_ZERO (i_q) (res_ref, mask, SIZE);
51   if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res_ref))
52     abort ();
53 }
54