mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:10 +00:00
fpu: Return struct from parts{64,128}_scalbn
At the same time, export. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
@@ -1633,22 +1633,24 @@ FloatRelation partsN(compare)(const FloatPartsN *a, const FloatPartsN *b,
|
||||
/*
|
||||
* Multiply A by 2 raised to the power N.
|
||||
*/
|
||||
static void partsN(scalbn)(FloatPartsN *a, int n, float_status *s)
|
||||
FloatPartsN partsN(scalbn)(const FloatPartsN *a, int n, float_status *s)
|
||||
{
|
||||
switch (a->cls) {
|
||||
case float_class_snan:
|
||||
case float_class_qnan:
|
||||
*a = partsN(return_nan)(a, s);
|
||||
break;
|
||||
return partsN(return_nan)(a, s);
|
||||
case float_class_zero:
|
||||
case float_class_inf:
|
||||
break;
|
||||
return *a;
|
||||
case float_class_denormal:
|
||||
float_raise(float_flag_input_denormal_used, s);
|
||||
/* fall through */
|
||||
case float_class_normal:
|
||||
a->exp += MIN(MAX(n, -0x10000), 0x10000);
|
||||
break;
|
||||
{
|
||||
FloatPartsN r = *a;
|
||||
r.exp += MIN(MAX(n, -0x10000), 0x10000);
|
||||
return r;
|
||||
}
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
|
||||
@@ -1910,7 +1910,7 @@ float16 float16_muladd_scalbn(float16 a, float16 b, float16 c,
|
||||
|
||||
/* Before rounding, scale. */
|
||||
if (scale) {
|
||||
parts64_scalbn(pr, scale, status);
|
||||
*pr = parts64_scalbn(pr, scale, status);
|
||||
}
|
||||
parts64_uncanon(pr, status, &float16_params, false);
|
||||
/* After rounding, apply negate result, especially for -0.0. */
|
||||
@@ -1937,7 +1937,7 @@ float32_muladd_scalbn(float32 a, float32 b, float32 c,
|
||||
|
||||
/* Before rounding, scale. */
|
||||
if (scale) {
|
||||
parts64_scalbn(pr, scale, status);
|
||||
*pr = parts64_scalbn(pr, scale, status);
|
||||
}
|
||||
parts64_uncanon(pr, status, &float32_params, false);
|
||||
/* After rounding, apply negate result, especially for -0.0. */
|
||||
@@ -1958,7 +1958,7 @@ float64_muladd_scalbn(float64 a, float64 b, float64 c,
|
||||
|
||||
/* Before rounding, scale. */
|
||||
if (scale) {
|
||||
parts64_scalbn(pr, scale, status);
|
||||
*pr = parts64_scalbn(pr, scale, status);
|
||||
}
|
||||
parts64_uncanon(pr, status, &float64_params, false);
|
||||
/* After rounding, apply negate result, especially for -0.0. */
|
||||
@@ -4312,7 +4312,7 @@ float16 float16_scalbn(float16 a, int n, float_status *status)
|
||||
{
|
||||
FloatParts64 p = float16_unpack_canonical(a, status);
|
||||
|
||||
parts64_scalbn(&p, n, status);
|
||||
p = parts64_scalbn(&p, n, status);
|
||||
return float16_round_pack_canonical(&p, status);
|
||||
}
|
||||
|
||||
@@ -4320,7 +4320,7 @@ float32 float32_scalbn(float32 a, int n, float_status *status)
|
||||
{
|
||||
FloatParts64 p = float32_unpack_canonical(a, status);
|
||||
|
||||
parts64_scalbn(&p, n, status);
|
||||
p = parts64_scalbn(&p, n, status);
|
||||
return float32_round_pack_canonical(&p, status);
|
||||
}
|
||||
|
||||
@@ -4328,7 +4328,7 @@ float64 float64_scalbn(float64 a, int n, float_status *status)
|
||||
{
|
||||
FloatParts64 p = float64_unpack_canonical(a, status);
|
||||
|
||||
parts64_scalbn(&p, n, status);
|
||||
p = parts64_scalbn(&p, n, status);
|
||||
return float64_round_pack_canonical(&p, status);
|
||||
}
|
||||
|
||||
@@ -4336,7 +4336,7 @@ bfloat16 bfloat16_scalbn(bfloat16 a, int n, float_status *status)
|
||||
{
|
||||
FloatParts64 p = bfloat16_unpack_canonical(a, status);
|
||||
|
||||
parts64_scalbn(&p, n, status);
|
||||
p = parts64_scalbn(&p, n, status);
|
||||
return bfloat16_round_pack_canonical(&p, status);
|
||||
}
|
||||
|
||||
@@ -4344,7 +4344,7 @@ float128 float128_scalbn(float128 a, int n, float_status *status)
|
||||
{
|
||||
FloatParts128 p = float128_unpack_canonical(a, status);
|
||||
|
||||
parts128_scalbn(&p, n, status);
|
||||
p = parts128_scalbn(&p, n, status);
|
||||
return float128_round_pack_canonical(&p, status);
|
||||
}
|
||||
|
||||
@@ -4355,7 +4355,7 @@ floatx80 floatx80_scalbn(floatx80 a, int n, float_status *status)
|
||||
if (!floatx80_unpack_canonical(&p, a, status)) {
|
||||
return floatx80_default_nan(status);
|
||||
}
|
||||
parts128_scalbn(&p, n, status);
|
||||
p = parts128_scalbn(&p, n, status);
|
||||
return floatx80_round_pack_canonical(&p, status);
|
||||
}
|
||||
|
||||
|
||||
@@ -214,4 +214,7 @@ FloatParts128 parts128_round_to_int(const FloatParts128 *a,
|
||||
FloatParts64 parts64_round_to_fmt(const FloatParts64 *p, float_status *s,
|
||||
const FloatFmt *fmt);
|
||||
|
||||
FloatParts64 parts64_scalbn(const FloatParts64 *a, int n, float_status *s);
|
||||
FloatParts128 parts128_scalbn(const FloatParts128 *a, int n, float_status *s);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user