2 /* { dg-options "-O2 -mavx512f -std=c99" } */
3 /* { dg-require-effective-target avx512f } */
4 /* { dg-require-effective-target c99_runtime } */
8 #include "avx512f-helper.h"
10 #define SIZE (AVX512F_LEN / 64)
11 #include "avx512f-mask-type.h"
19 long long int int_val
;
24 get_norm_mant (double source
, int signctrl
, int interv
)
26 long long src
, sign
, exp
, fraction
;
27 union fp_int_t bin_conv
;
29 bin_conv
.fp_val
= source
;
30 src
= bin_conv
.int_val
;
31 sign
= (signctrl
& 0x1) ? 0 : (src
>> 63);
32 exp
= (src
& 0x7ff0000000000000) >> 52;
33 fraction
= (src
& 0xfffffffffffff);
36 return signbit (source
) ? -NAN
: NAN
;
37 if (source
== 0.0 || source
== -0.0 || isinf (source
))
38 return sign
? -1.0 : 1.0;
39 if (signbit (source
) && (signctrl
& 0x2))
41 if (!isnormal (source
))
43 src
= (src
& 0xfff7ffffffffffff);
45 while (!(src
& 0x8000000000000))
47 src
+= fraction
& 0x8000000000000;
48 fraction
= fraction
<< 1;
59 exp
= ((exp
- 0x3ff) & 0x1) ? 0x3fe : 0x3ff;
65 exp
= (fraction
& 0x8000000000000) ? 0x3fe : 0x3ff;
71 bin_conv
.int_val
= (sign
<< 63) | (exp
<< 52) | fraction
;
72 return bin_conv
.fp_val
;
77 CALC (double *r
, double *s
, int interv
, int signctrl
)
80 for (i
= 0; i
< SIZE
; i
++)
82 r
[i
] = get_norm_mant (s
[i
], signctrl
, interv
);
90 UNION_TYPE (AVX512F_LEN
, d
) res1
, res2
, res3
, src
;
91 MASK_TYPE mask
= MASK_VALUE
;
93 int interv
= _MM_MANT_NORM_p5_1
;
94 int signctrl
= _MM_MANT_SIGN_src
;
97 for (i
= 0; i
< SIZE
; i
++)
99 src
.a
[i
] = 34.67 * i
* sign
;
102 for (i
= 0; i
< SIZE
; i
++)
103 res2
.a
[i
] = DEFAULT_VALUE
;
105 res1
.x
= INTRINSIC (_getmant_pd
) (src
.x
, interv
, signctrl
);
107 INTRINSIC (_mask_getmant_pd
) (res2
.x
, mask
, src
.x
, interv
,
110 INTRINSIC (_maskz_getmant_pd
) (mask
, src
.x
, interv
, signctrl
);
112 CALC (res_ref
, src
.a
, interv
, signctrl
);
114 if (UNION_CHECK (AVX512F_LEN
, d
) (res1
, res_ref
))
117 MASK_MERGE (d
) (res_ref
, mask
, SIZE
);
118 if (UNION_CHECK (AVX512F_LEN
, d
) (res2
, res_ref
))
121 MASK_ZERO (d
) (res_ref
, mask
, SIZE
);
122 if (UNION_CHECK (AVX512F_LEN
, d
) (res3
, res_ref
))