1 /* { dg-do run } */
2 /* { dg-options "-O2 -mavx512f" } */
3 /* { dg-require-effective-target avx512f } */
4 
5 #define AVX512F
6 
7 #include "avx512f-helper.h"
8 
9 #define SIZE (AVX512F_LEN / 64)
10 #include "avx512f-mask-type.h"
11 #include <math.h>
12 
13 void static
CALC(double * r,double * s1,double * s2)14 CALC (double *r, double *s1, double *s2)
15 {
16   int i;
17   for (i = 0; i < SIZE; i++)
18     {
19       r[i] = ldexp (s1[i], floor (s2[i]));
20     }
21 }
22 
23 void
TEST(void)24 TEST (void)
25 {
26   int i, sign;
27   UNION_TYPE (AVX512F_LEN, d) res1, res2, res3, src1, src2;
28   MASK_TYPE mask = MASK_VALUE;
29   double res_ref[SIZE];
30 
31   sign = -1;
32   for (i = 0; i < SIZE; i++)
33     {
34       src1.a[i] = 1.5 + 34.67 * i * sign;
35       src2.a[i] = -22.17 * i * sign;
36       sign = sign * -1;
37     }
38   for (i = 0; i < SIZE; i++)
39     res2.a[i] = DEFAULT_VALUE;
40 
41   res1.x = INTRINSIC (_scalef_pd) (src1.x, src2.x);
42   res2.x = INTRINSIC (_mask_scalef_pd) (res2.x, mask, src1.x, src2.x);
43   res3.x = INTRINSIC (_maskz_scalef_pd) (mask, src1.x, src2.x);
44 
45   CALC (res_ref, src1.a, src2.a);
46 
47   if (UNION_CHECK (AVX512F_LEN, d) (res1, res_ref))
48     abort ();
49 
50   MASK_MERGE (d) (res_ref, mask, SIZE);
51   if (UNION_CHECK (AVX512F_LEN, d) (res2, res_ref))
52     abort ();
53 
54   MASK_ZERO (d) (res_ref, mask, SIZE);
55   if (UNION_CHECK (AVX512F_LEN, d) (res3, res_ref))
56     abort ();
57 }
58