1 /* { dg-do run } */
2 /* { dg-options "-mavx512f -O2" } */
3 /* { dg-require-effective-target avx512f } */
4 
5 #define SIZE (128 / 64)
6 
7 #include <math.h>
8 #include "avx512f-check.h"
9 #include "avx512f-helper.h"
10 #include "avx512f-mask-type.h"
11 
12 static void
compute_vgetexpsd(double * s,double * r)13 compute_vgetexpsd (double *s, double *r)
14 {
15   r[0] = floor (log (s[0]) / log (2));
16   r[1] = s[1];
17 }
18 
19 void static
avx512f_test(void)20 avx512f_test (void)
21 {
22   int i;
23   union128d res1, res2, res3, res4, res5, res6, s1;
24   MASK_TYPE mask = MASK_VALUE;
25   double res_ref[SIZE];
26 
27   for (i = 0; i < SIZE; i++)
28     {
29       s1.a[i] = 5.0 - i;
30       res2.a[i] = DEFAULT_VALUE;
31       res5.a[i] = DEFAULT_VALUE;
32     }
33 
34   res1.x = _mm_getexp_sd (s1.x, s1.x);
35   res2.x = _mm_mask_getexp_sd (res2.x, mask, s1.x, s1.x);
36   res3.x = _mm_maskz_getexp_sd (mask, s1.x, s1.x);
37   res4.x = _mm_getexp_round_sd (s1.x, s1.x, _MM_FROUND_NO_EXC);
38   res5.x = _mm_mask_getexp_round_sd (res5.x, mask, s1.x, s1.x, _MM_FROUND_NO_EXC);
39   res6.x = _mm_maskz_getexp_round_sd (mask, s1.x, s1.x, _MM_FROUND_NO_EXC);
40 
41   compute_vgetexpsd (s1.a, res_ref);
42 
43   if (check_fp_union128d (res1, res_ref))
44     abort ();
45 
46   MASK_MERGE (d) (res_ref, mask, 1);
47   if (check_fp_union128d (res2, res_ref))
48     abort ();
49 
50   MASK_ZERO (d) (res_ref, mask, 1);
51   if (check_fp_union128d (res3, res_ref))
52     abort ();
53 
54   compute_vgetexpsd (s1.a, res_ref);
55 
56   if (check_fp_union128d (res4, res_ref))
57     abort ();
58 
59   MASK_MERGE (d) (res_ref, mask, 1);
60   if (check_fp_union128d (res5, res_ref))
61     abort ();
62 
63   MASK_ZERO (d) (res_ref, mask, 1);
64   if (check_fp_union128d (res6, res_ref))
65     abort ();
66 }
67