2 /* { dg-options "-mavx512f -O2 -std=c99" } */
3 /* { dg-require-effective-target avx512f } */
4 /* { dg-require-effective-target c99_runtime } */
6 #include "avx512f-check.h"
8 #include "avx512f-helper.h"
11 #include "avx512f-mask-type.h"
15 long long int int_val
;
20 get_norm_mant (double source
, int signctrl
, int interv
)
22 long long src
, sign
, exp
, fraction
;
24 union fp_int_t bin_conv
;
26 bin_conv
.fp_val
= source
;
27 src
= bin_conv
.int_val
;
28 sign
= (signctrl
& 0x1) ? 0 : (src
>> 63);
29 exp
= (src
& 0x7ff0000000000000) >> 52;
30 fraction
= (src
& 0xfffffffffffff);
33 return signbit (source
) ? -NAN
: NAN
;
34 if (source
== 0.0 || source
== -0.0 || isinf (source
))
35 return sign
? -1.0 : 1.0;
36 if (signbit (source
) && (signctrl
& 0x2))
38 if (!isnormal (source
))
40 src
= (src
& 0xfff7ffffffffffff);
42 while (!(src
& 0x8000000000000))
44 src
+= fraction
& 0x8000000000000;
45 fraction
= fraction
<< 1;
56 exp
= ((exp
- 0x3ff) & 0x1) ? 0x3fe : 0x3ff;
62 exp
= (fraction
& 0x8000000000000) ? 0x3fe : 0x3ff;
68 bin_conv
.int_val
= (sign
<< 63) | (exp
<< 52) | fraction
;
69 return bin_conv
.fp_val
;
73 compute_vgetmantsd (double *r
, double *s1
, double *s2
, int interv
,
76 r
[0] = get_norm_mant (s2
[0], signctrl
, interv
);
83 union128d res1
, res2
, res3
, res4
, res5
, res6
, src1
, src2
;
85 MASK_TYPE mask
= MASK_VALUE
;
87 src1
.x
= _mm_set_pd (-3.0, 111.111);
88 src2
.x
= _mm_set_pd (222.222, -2.0);
91 for (i
= 0; i
< SIZE
; i
++)
93 res2
.a
[i
] = DEFAULT_VALUE
;
94 res5
.a
[i
] = DEFAULT_VALUE
;
97 res1
.x
= _mm_getmant_sd (src1
.x
, src2
.x
, _MM_MANT_NORM_p5_1
, _MM_MANT_SIGN_src
);
98 res2
.x
= _mm_mask_getmant_sd (res2
.x
, mask
, src1
.x
, src2
.x
, _MM_MANT_NORM_p5_1
, _MM_MANT_SIGN_src
);
99 res3
.x
= _mm_maskz_getmant_sd (mask
, src1
.x
, src2
.x
, _MM_MANT_NORM_p5_1
, _MM_MANT_SIGN_src
);
100 res4
.x
= _mm_getmant_round_sd (src1
.x
, src2
.x
, _MM_MANT_NORM_p5_1
, _MM_MANT_SIGN_src
, _MM_FROUND_NO_EXC
);
101 res5
.x
= _mm_mask_getmant_round_sd (res5
.x
, mask
, src1
.x
, src2
.x
, _MM_MANT_NORM_p5_1
, _MM_MANT_SIGN_src
, _MM_FROUND_NO_EXC
);
102 res6
.x
= _mm_maskz_getmant_round_sd (mask
, src1
.x
, src2
.x
, _MM_MANT_NORM_p5_1
, _MM_MANT_SIGN_src
, _MM_FROUND_NO_EXC
);
104 compute_vgetmantsd (res_ref
, src1
.a
, src2
.a
, _MM_MANT_NORM_p5_1
, _MM_MANT_SIGN_src
);
106 if (check_union128d (res1
, res_ref
))
109 MASK_MERGE (d
) (res_ref
, mask
, 1);
110 if (check_union128d (res2
, res_ref
))
113 MASK_ZERO (d
) (res_ref
, mask
, 1);
114 if (check_union128d (res3
, res_ref
))
117 compute_vgetmantsd (res_ref
, src1
.a
, src2
.a
, _MM_MANT_NORM_p5_1
, _MM_MANT_SIGN_src
);
119 if (check_union128d (res4
, res_ref
))
122 MASK_MERGE (d
) (res_ref
, mask
, 1);
123 if (check_union128d (res5
, res_ref
))
126 MASK_ZERO (d
) (res_ref
, mask
, 1);
127 if (check_union128d (res6
, res_ref
))