[PATCH] target/sparc: don't set FSR_NVA when comparing unordered floats

Clément Chigot posted 1 patch 6 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20250425093513.863289-1-chigot@adacore.com
Maintainers: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>
target/sparc/fop_helper.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] target/sparc: don't set FSR_NVA when comparing unordered floats
Posted by Clément Chigot 6 months, 3 weeks ago
FSR_NVA should be set when one of the operands is a signaling NaN or
when using FCMPEx instructions. But those cases are already handled
within check_ieee_exception or floatxx_compare functions.
Otherwise, it should be left untouched.

FTR, this was detected by inf-compare-[5678] tests within gcc
testsuites.

Signed-off-by: Clément Chigot <chigot@adacore.com>
---
 target/sparc/fop_helper.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c
index c25097d07f..b57da7c9ea 100644
--- a/target/sparc/fop_helper.c
+++ b/target/sparc/fop_helper.c
@@ -446,7 +446,6 @@ static uint32_t finish_fcmp(CPUSPARCState *env, FloatRelation r, uintptr_t ra)
     case float_relation_greater:
         return 2;
     case float_relation_unordered:
-        env->fsr |= FSR_NVA;
         return 3;
     }
     g_assert_not_reached();
-- 
2.34.1


Re: [PATCH] target/sparc: don't set FSR_NVA when comparing unordered floats
Posted by Mark Cave-Ayland 5 months, 3 weeks ago
On 25/04/2025 10:35, Clément Chigot wrote:

> FSR_NVA should be set when one of the operands is a signaling NaN or
> when using FCMPEx instructions. But those cases are already handled
> within check_ieee_exception or floatxx_compare functions.
> Otherwise, it should be left untouched.
> 
> FTR, this was detected by inf-compare-[5678] tests within gcc
> testsuites.
> 
> Signed-off-by: Clément Chigot <chigot@adacore.com>
> ---
>   target/sparc/fop_helper.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c
> index c25097d07f..b57da7c9ea 100644
> --- a/target/sparc/fop_helper.c
> +++ b/target/sparc/fop_helper.c
> @@ -446,7 +446,6 @@ static uint32_t finish_fcmp(CPUSPARCState *env, FloatRelation r, uintptr_t ra)
>       case float_relation_greater:
>           return 2;
>       case float_relation_unordered:
> -        env->fsr |= FSR_NVA;
>           return 3;
>       }
>       g_assert_not_reached();

Thanks! I've added Richard's R-B and applied this to my qemu-sparc branch.


ATB,

Mark.