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