[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 14/22] softfloat: Add support for ties-away roun
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH 14/22] softfloat: Add support for ties-away rounding |
Date: |
Tue, 31 Dec 2013 06:51:21 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
[Tom, this is exactly what you need to fix FRIN rounding.]
On 12/31/2013 05:35 AM, Peter Maydell wrote:
> - float_round_to_zero = 3
> + float_round_to_zero = 3,
> + float_round_ties_away = 4,
I'm not keen on the name. Does anyone else think float_round_nearest_inf is a
better name?
> +++ b/fpu/softfloat.c
> @@ -107,7 +107,7 @@ static int32 roundAndPackInt32( flag zSign, uint64_t absZ
> STATUS_PARAM)
> roundingMode = STATUS(float_rounding_mode);
> roundNearestEven = ( roundingMode == float_round_nearest_even );
> roundIncrement = 0x40;
> - if ( ! roundNearestEven ) {
> + if (!roundNearestEven && roundingMode != float_round_ties_away) {
> if ( roundingMode == float_round_to_zero ) {
> roundIncrement = 0;
> }
This whole section of code is now a mess. I know you're looking for minimal
changes here, but perhaps I can convince you that
switch (roundingMode) {
case float_round_nearest_even:
case float_round_ties_away:
roundIncrement = 0x40;
break;
case float_round_to_zero:
roundIncrement = 0;
break;
case float_round_up:
roundIncrement = zSign ? 0 : 0x7f;
break;
case float_round_down:
roundIncrement = zSign ? 0x7f : 0;
break;
default:
abort();
}
is easier to follow?
Otherwise, I don't see anything actually wrong in the patch.
r~
- [Qemu-devel] [PATCH 06/22] softfloat: Fix factor 2 error for scalbn on denormal inputs, (continued)
- [Qemu-devel] [PATCH 06/22] softfloat: Fix factor 2 error for scalbn on denormal inputs, Peter Maydell, 2013/12/31
- [Qemu-devel] [PATCH 05/22] softfloat: Only raise Invalid when conversions to int are out of range, Peter Maydell, 2013/12/31
- [Qemu-devel] [PATCH 09/22] softfloat: Fix float64_to_uint32, Peter Maydell, 2013/12/31
- [Qemu-devel] [PATCH 17/22] target-arm: Ignore most exceptions from scalbn when doing fixpoint conversion, Peter Maydell, 2013/12/31
- [Qemu-devel] [PATCH 21/22] target-arm: A64: Add 1-source 32-to-32 and 64-to-64 FP instructions, Peter Maydell, 2013/12/31
- [Qemu-devel] [PATCH 04/22] softfloat: Fix float64_to_uint64, Peter Maydell, 2013/12/31
- [Qemu-devel] [PATCH 13/22] softfloat: Add float16 <=> float64 conversion functions, Peter Maydell, 2013/12/31
- [Qemu-devel] [PATCH 14/22] softfloat: Add support for ties-away rounding, Peter Maydell, 2013/12/31
- Re: [Qemu-devel] [PATCH 14/22] softfloat: Add support for ties-away rounding,
Richard Henderson <=
- [Qemu-devel] [PATCH 12/22] softfloat: Factor out RoundAndPackFloat16 and NormalizeFloat16Subnormal, Peter Maydell, 2013/12/31