1 /* { dg-do run } */
2 /* { dg-require-effective-target avx512er } */
3 /* { dg-options "-O2 -mavx512er" } */
4 
5 #include "avx512er-check.h"
6 #include "avx512f-mask-type.h"
7 #include "avx512f-helper.h"
8 #include <math.h>
9 
10 void static
compute_vexp2pd(double * s,double * r)11 compute_vexp2pd (double *s, double *r)
12 {
13   int i;
14   for (i = 0; i < 8; i++)
15     r[i] = pow (2.0, s[i]);
16 }
17 
18 void static
avx512er_test(void)19 avx512er_test (void)
20 {
21   union512d src, res1, res2, res3;
22   __mmask8 mask = MASK_VALUE;
23   double res_ref[8];
24   int i;
25 
26   for (i = 0; i < 8; i++)
27     {
28       src.a[i] = 179.345 - 6.5645 * i;
29       res2.a[i] = DEFAULT_VALUE;
30     }
31 
32   res1.x = _mm512_exp2a23_pd (src.x);
33   res2.x = _mm512_mask_exp2a23_pd (res2.x, mask, src.x);
34   res3.x = _mm512_maskz_exp2a23_pd (mask, src.x);
35 
36   compute_vexp2pd (src.a, res_ref);
37 
38   if (check_rough_union512d (res1, res_ref, 0.0001))
39     abort ();
40 
41   MASK_MERGE (d) (res_ref, mask, 8);
42   if (check_rough_union512d (res2, res_ref, 0.0001))
43     abort ();
44 
45   MASK_ZERO (d) (res_ref, mask, 8);
46   if (check_rough_union512d (res3, res_ref, 0.0001))
47     abort ();
48 }
49