[PATCH for-10.0 23/25] target/i386: Set Float3NaNPropRule explicitly

Peter Maydell posted 25 patches 3 weeks, 6 days ago
[PATCH for-10.0 23/25] target/i386: Set Float3NaNPropRule explicitly
Posted by Peter Maydell 3 weeks, 6 days ago
Set the Float3NaNPropRule explicitly for i386.  We had no
i386-specific behaviour in the old ifdef ladder, so we were using the
default "prefer a then b then c" fallback.  This is very likely wrong
for i386, but in this refactoring we don't want to make a behaviour
change, so we leave a TODO note.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/i386/tcg/fpu_helper.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
index e9de084a96d..b62719dead1 100644
--- a/target/i386/tcg/fpu_helper.c
+++ b/target/i386/tcg/fpu_helper.c
@@ -180,6 +180,8 @@ void cpu_init_fp_statuses(CPUX86State *env)
      * against the manual.
      */
     set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->sse_status);
+    /* Similarly the NaN propagation rule is likely wrong. */
+    set_float_3nan_prop_rule(float_3nan_prop_abc, &env->sse_status);
 }
 
 static inline uint8_t save_exception_flags(CPUX86State *env)
-- 
2.34.1
Re: [PATCH for-10.0 23/25] target/i386: Set Float3NaNPropRule explicitly
Posted by Richard Henderson 3 weeks, 6 days ago
On 11/28/24 04:43, Peter Maydell wrote:
> Set the Float3NaNPropRule explicitly for i386.  We had no
> i386-specific behaviour in the old ifdef ladder, so we were using the
> default "prefer a then b then c" fallback.  This is very likely wrong
> for i386, but in this refactoring we don't want to make a behaviour
> change, so we leave a TODO note.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   target/i386/tcg/fpu_helper.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
> index e9de084a96d..b62719dead1 100644
> --- a/target/i386/tcg/fpu_helper.c
> +++ b/target/i386/tcg/fpu_helper.c
> @@ -180,6 +180,8 @@ void cpu_init_fp_statuses(CPUX86State *env)
>        * against the manual.
>        */
>       set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->sse_status);
> +    /* Similarly the NaN propagation rule is likely wrong. */
> +    set_float_3nan_prop_rule(float_3nan_prop_abc, &env->sse_status);

Per my response to patch 11, this is correct.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~