From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: Richard Henderson <richard.henderson@linaro.org>,
"Lucas Mateus Castro(alqotel)" <lucas.araujo@eldorado.org.br>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Cc: "Cédric Le Goater" <clg@kaod.org>,
"David Gibson" <david@gibson.dropbear.id.au>,
"Greg Kurz" <groug@kaod.org>
Subject: Re: [PATCH 2/2] target/ppc: Bugfix FP when OE/UE are set
Date: Fri, 5 Aug 2022 14:26:35 -0300 [thread overview]
Message-ID: <d35a72e4-0f04-e70a-15eb-4c3cea183a92@gmail.com> (raw)
In-Reply-To: <9e0592b7-3388-1707-bbf7-849a84c6e998@linaro.org>
On 8/5/22 14:17, Richard Henderson wrote:
> On 8/5/22 07:15, Lucas Mateus Castro(alqotel) wrote:
>> From: "Lucas Mateus Castro (alqotel)" <lucas.araujo@eldorado.org.br>
>>
>> When an overflow exception occurs and OE is set the intermediate result
>> should be adjusted (by subtracting from the exponent) to avoid rounding
>> to inf. The same applies to an underflow exceptionion and UE (but adding
>> to the exponent). To do this set the fp_status.rebias_overflow when OE
>> is set and fp_status.rebias_underflow when UE is set as the FPU will
>> recalculate in case of a overflow/underflow if the according rebias* is
>> set.
>>
>> Signed-off-by: Lucas Mateus Castro (alqotel) <lucas.araujo@eldorado.org.br>
>> ---
>> target/ppc/cpu.c | 2 ++
>> target/ppc/fpu_helper.c | 2 --
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
>> index 401b6f9e63..0ebac04bc4 100644
>> --- a/target/ppc/cpu.c
>> +++ b/target/ppc/cpu.c
>> @@ -120,6 +120,8 @@ void ppc_store_fpscr(CPUPPCState *env, target_ulong val)
>> val |= FP_FEX;
>> }
>> env->fpscr = val;
>> + env->fp_status.rebias_overflow = (FP_OE & env->fpscr) ? true : false;
>> + env->fp_status.rebias_underflow = (FP_UE & env->fpscr) ? true : false;
>
> No point in the ?: operator.
>
> Otherwise,
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
Amended in the tree. No need to re-send.
diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 0ebac04bc4..947a4bfe1f 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -120,8 +120,8 @@ void ppc_store_fpscr(CPUPPCState *env, target_ulong val)
val |= FP_FEX;
}
env->fpscr = val;
- env->fp_status.rebias_overflow = (FP_OE & env->fpscr) ? true : false;
- env->fp_status.rebias_underflow = (FP_UE & env->fpscr) ? true : false;
+ env->fp_status.rebias_overflow = FP_OE & env->fpscr;
+ env->fp_status.rebias_underflow = FP_UE & env->fpscr;
if (tcg_enabled()) {
fpscr_set_rounding_mode(env);
}
Thanks,
Daniel
>
> r~
>
>> if (tcg_enabled()) {
>> fpscr_set_rounding_mode(env);
>> }
>> diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
>> index 134804628b..c17575de5d 100644
>> --- a/target/ppc/fpu_helper.c
>> +++ b/target/ppc/fpu_helper.c
>> @@ -344,7 +344,6 @@ static inline int float_overflow_excp(CPUPPCState *env)
>> bool overflow_enabled = !!(env->fpscr & FP_OE);
>> if (overflow_enabled) {
>> - /* XXX: should adjust the result */
>> /* Update the floating-point enabled exception summary */
>> env->fpscr |= FP_FEX;
>> /* We must update the target FPR before raising the exception */
>> @@ -363,7 +362,6 @@ static inline void float_underflow_excp(CPUPPCState *env)
>> /* Update the floating-point exception summary */
>> env->fpscr |= FP_FX;
>> if (env->fpscr & FP_UE) {
>> - /* XXX: should adjust the result */
>> /* Update the floating-point enabled exception summary */
>> env->fpscr |= FP_FEX;
>> /* We must update the target FPR before raising the exception */
>
next prev parent reply other threads:[~2022-08-05 17:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-05 14:15 [PATCH 0/2] Floating-point OE/UE exception bug Lucas Mateus Castro(alqotel)
2022-08-05 14:15 ` [PATCH 1/2] fpu: Add rebias bool, value and operation Lucas Mateus Castro(alqotel)
2022-08-05 17:13 ` Richard Henderson
2022-08-05 14:15 ` [PATCH 2/2] target/ppc: Bugfix FP when OE/UE are set Lucas Mateus Castro(alqotel)
2022-08-05 17:17 ` Richard Henderson
2022-08-05 17:26 ` Daniel Henrique Barboza [this message]
2022-08-05 16:20 ` [PATCH 0/2] Floating-point OE/UE exception bug Alex Bennée
2022-08-05 17:00 ` Lucas Mateus Martins Araujo e Castro
2022-08-05 17:02 ` Lucas Mateus Martins Araujo e Castro
2022-08-05 17:06 ` Richard Henderson
2022-08-05 17:27 ` Daniel Henrique Barboza
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=d35a72e4-0f04-e70a-15eb-4c3cea183a92@gmail.com \
--to=danielhb413@gmail.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=lucas.araujo@eldorado.org.br \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=richard.henderson@linaro.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).