qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH] target/alpha: Don't corrupt error_code with unknown softfloat flags
Date: Tue, 11 Feb 2025 08:16:20 -0800	[thread overview]
Message-ID: <782799f1-1ec6-4ac3-aa55-6a2a769fcaf3@linaro.org> (raw)
In-Reply-To: <20250211130626.3940412-1-peter.maydell@linaro.org>

On 2/11/25 05:06, Peter Maydell wrote:
> In do_cvttq() we set env->error_code with what is supposed to be a
> set of FPCR exception bit values.  However, if the set of float
> exception flags we get back from softfloat for the conversion
> includes a flag which is not one of the three we expect here
> (invalid_cvti, invalid, inexact) then we will fall through the
> if-ladder and set env->error_code to the unconverted softfloat
> exception_flag value.  This will then cause us to take a spurious
> exception.
> 
> This is harmless now, but when we add new floating point exception
> flags to softfloat it will cause problems.  Add an else clause to the
> if-ladder to make it ignore any float exception flags it doesn't care
> about.
> 
> Specifically, without this fix, 'make check-tcg' will fail for Alpha
> when the commit adding float_flag_input_denormal_used lands.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> I guess I forgot to run a 'make check-tcg' for all targets until
> I was getting around to queuing the FEAT_AFP series :-/
> 
>   target/alpha/fpu_helper.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/target/alpha/fpu_helper.c b/target/alpha/fpu_helper.c
> index 63d9e9ce39c..f810a9b6a47 100644
> --- a/target/alpha/fpu_helper.c
> +++ b/target/alpha/fpu_helper.c
> @@ -476,6 +476,8 @@ static uint64_t do_cvttq(CPUAlphaState *env, uint64_t a, int roundmode)
>               exc = FPCR_INV;
>           } else if (exc & float_flag_inexact) {
>               exc = FPCR_INE;
> +        } else {
> +            exc = 0;
>           }
>       }
>       env->error_code = exc;

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

And I think there's a case for
Fixes: aa3bad5b59e7 ("target/alpha: Use float64_to_int64_modulo for CVTTQ")


r~


      parent reply	other threads:[~2025-02-11 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-11 13:06 [PATCH] target/alpha: Don't corrupt error_code with unknown softfloat flags Peter Maydell
2025-02-11 16:13 ` Philippe Mathieu-Daudé
2025-02-11 16:16 ` Richard Henderson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=782799f1-1ec6-4ac3-aa55-6a2a769fcaf3@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).