qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: "Víctor Colombo" <victor.colombo@eldorado.org.br>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Cc: clg@kaod.org, danielhb413@gmail.com, david@gibson.dropbear.id.au,
	groug@kaod.org
Subject: Re: [PATCH 1/2] target/ppc: Fix FPSCR.FI bit being cleared when it shouldn't
Date: Mon, 9 May 2022 15:15:36 -0700	[thread overview]
Message-ID: <46cee6f7-d98e-51e8-b3bc-c4f2497fbb97@linaro.org> (raw)
In-Reply-To: <20220509124836.27819-2-victor.colombo@eldorado.org.br>

On 5/9/22 07:48, Víctor Colombo wrote:
> -static inline void float_inexact_excp(CPUPPCState *env)
> +static inline void float_inexact_excp(CPUPPCState *env, bool set_fi)
>   {
>       CPUState *cs = env_cpu(env);
>   
> -    env->fpscr |= FP_FI;
> +    if (set_fi) {
> +        env->fpscr |= FP_FI;
> +    }
>       env->fpscr |= FP_XX;
>       /* Update the floating-point exception summary */
>       env->fpscr |= FP_FX;

I think it would be better to move the change to FI from here...

> @@ -462,7 +464,8 @@ void helper_fpscr_check_status(CPUPPCState *env)
>       }
>   }
>   
> -static void do_float_check_status(CPUPPCState *env, uintptr_t raddr)
> +static void do_float_check_status(CPUPPCState *env, bool change_fi,
> +                                  uintptr_t raddr)
>   {
>       CPUState *cs = env_cpu(env);
>       int status = get_float_exception_flags(&env->fp_status);
> @@ -473,8 +476,8 @@ static void do_float_check_status(CPUPPCState *env, uintptr_t raddr)
>           float_underflow_excp(env);
>       }
>       if (status & float_flag_inexact) {
> -        float_inexact_excp(env);
> -    } else {
> +        float_inexact_excp(env, change_fi);
> +    } else if (change_fi) {
>           env->fpscr &= ~FP_FI; /* clear the FPSCR[FI] bit */
>       }

... to here.  E.g.

     if (status & float_flag_inexact) {
         float_inexact_excp(env);
     }
     if (change_fi) {
         if (status & float_flag_inexact) {
             env->fpscr |= FP_FI;
         } else {
             env->fpscr &= ~FP_FI;
         }
     }

or indeed

     env->fpscr = FIELD_DP64(env->fpscr, FPSCR, FI,
                             !!(status & float_flag_inexact));

Otherwise it all looks plausible.

> @@ -1690,9 +1693,9 @@ uint32_t helper_efdcmpeq(CPUPPCState *env, uint64_t op1, uint64_t op2)
>    *   nels  - number of elements (1, 2 or 4)
>    *   tp    - type (float32 or float64)
>    *   fld   - vsr_t field (VsrD(*) or VsrW(*))
> - *   sfprf - set FPRF
> + *   sfifprf - set FI and FPRF
>    */
> -#define VSX_ADD_SUB(name, op, nels, tp, fld, sfprf, r2sp)                    \
> +#define VSX_ADD_SUB(name, op, nels, tp, fld, sfifprf, r2sp)                  \


It might be easier to read if this renaming is done as a separate step.


r~


  reply	other threads:[~2022-05-09 22:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09 12:48 [PATCH 0/2] target/ppc: Fix FPSCR.FI bit Víctor Colombo
2022-05-09 12:48 ` [PATCH 1/2] target/ppc: Fix FPSCR.FI bit being cleared when it shouldn't Víctor Colombo
2022-05-09 22:15   ` Richard Henderson [this message]
2022-05-09 12:48 ` [PATCH 2/2] target/ppc: Fix FPSCR.FI changing in float_overflow_excp() Víctor Colombo
2022-05-09 23:01   ` Richard Henderson

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=46cee6f7-d98e-51e8-b3bc-c4f2497fbb97@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=clg@kaod.org \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=victor.colombo@eldorado.org.br \
    /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).