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(long long * r,float * s)12 CALC (long long *r, float *s)
13 {
14   int i;
15   for (i = 0; i < SIZE; i++)
16     r[i] = (long long) (s[i] + ((s[i] >= 0) ? 0.5 : -0.5));
17 }
18 
19 void
TEST(void)20 TEST (void)
21 {
22   int i, sign;
23   UNION_TYPE (AVX512F_LEN, i_q) res1, res2, res3;
24   UNION_TYPE (AVX512F_LEN_HALF,) src;
25   MASK_TYPE mask = MASK_VALUE;
26   long long res_ref[SIZE];
27 
28   sign = -1;
29   for (i = 0; i < SIZE; i++)
30     {
31       res2.a[i] = DEFAULT_VALUE;
32       src.a[i] = 1.5 + 34.67 * i * sign;
33       sign = sign * -1;
34     }
35 
36   res1.x = INTRINSIC (_cvtps_epi64) (src.x);
37   res2.x = INTRINSIC (_mask_cvtps_epi64) (res2.x, mask, src.x);
38   res3.x = INTRINSIC (_maskz_cvtps_epi64) (mask, src.x);
39 
40   CALC (res_ref, src.a);
41 
42   if (UNION_CHECK (AVX512F_LEN, i_q) (res1, res_ref))
43     abort ();
44 
45   MASK_MERGE (i_q) (res_ref, mask, SIZE);
46   if (UNION_CHECK (AVX512F_LEN, i_q) (res2, res_ref))
47     abort ();
48 
49   MASK_ZERO (i_q) (res_ref, mask, SIZE);
50   if (UNION_CHECK (AVX512F_LEN, i_q) (res3, res_ref))
51     abort ();
52 }
53