From: Richard Henderson <richard.henderson@linaro.org>
To: WANG Rui <wangrui@loongson.cn>, Song Gao <gaosong@loongson.cn>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
qemu-devel@nongnu.org, qemu@hev.cc,
mengqinggang <mengqinggang@loongson.cn>
Subject: Re: [RFC PATCH v2] target/loongarch: Fix incorrect rounding in fnm{add,sub} under certain modes
Date: Wed, 7 May 2025 08:04:42 -0700 [thread overview]
Message-ID: <f92c8c65-8fb4-4cfe-b793-a5aa17f11c1d@linaro.org> (raw)
In-Reply-To: <20250507091455.3257138-1-wangrui@loongson.cn>
On 5/7/25 02:14, WANG Rui wrote:
> This patch fixes incorrect results for `[xv]fnm{add,sub}.{s,d}`
> instructions when rounding toward {zero, positive, negative}.
>
> According to the LoongArch ISA specification, the result of an
> instruction like `FNMSUB.D` is computed as:
>
> FR[fd] = -FP64_fusedMultiplyAdd(FR[fj], FR[fk], -FR[fa])
>
> Here, `FP64_fusedMultiplyAdd()` performs a fused multiply-add operation
> compliant with IEEE 754-2008. The negation is applied to the fully
> rounded result of the fused operation - not to any intermediate value.
> This behavior is specifiec to LoongArch and differs from other arches,
> which is why the existing `float_muladd_negate_result` flag does not
> model it correctly.
Loongarch does not differ from other arches; we got it wrong for everyone.
There's no need for a new flag.
r~
next prev parent reply other threads:[~2025-05-07 15:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 9:14 [RFC PATCH v2] target/loongarch: Fix incorrect rounding in fnm{add, sub} under certain modes WANG Rui
2025-05-07 15:04 ` Richard Henderson [this message]
2025-05-07 15:25 ` [RFC PATCH v2] target/loongarch: Fix incorrect rounding in fnm{add,sub} " WANG Rui
2025-05-07 16:16 ` 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=f92c8c65-8fb4-4cfe-b793-a5aa17f11c1d@linaro.org \
--to=richard.henderson@linaro.org \
--cc=gaosong@loongson.cn \
--cc=mengqinggang@loongson.cn \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu@hev.cc \
--cc=wangrui@loongson.cn \
/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).