qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Qi Hu <huqi@loongson.cn>, Song Gao <gaosong@loongson.cn>,
	Xiaojuan Yang <yangxiaojuan@loongson.cn>
Cc: qemu-devel@nongnu.org, Feiyang Chen <chenfeiyang@loongson.cn>
Subject: Re: [PATCH] target/loongarch: Fix "movfcsr2gr" gets wrong value
Date: Sat, 6 Aug 2022 09:15:34 -0700	[thread overview]
Message-ID: <26f5be99-e9be-df9d-be50-1a2f2cd64986@linaro.org> (raw)
In-Reply-To: <20220806133426.542314-1-huqi@loongson.cn>

On 8/6/22 06:34, Qi Hu wrote:
> In follow sequence:
>    movgr2fcsr $r0,$r0
>    movgr2fr.d $f0,$r0
>    fdiv.d     $f0,$f0,$f0
>    movfcsr2gr $r12,$r0
> 
> The value of $r12 is "0x00000000", but it should be "0x10100000"(V flag).
> 
> These fp helpers are definded with wrong flag "TCG_CALL_NO_WG" (but the
> helpers write the globle "fcsr"). This causes the "fdiv" helper updates
> the "fcsr" into mem, but "movfcsr2gr" does not load it from mem.
> 
> Reported-by: Feiyang Chen<chenfeiyang@loongson.cn>
> Signed-off-by: Qi Hu<huqi@loongson.cn>
> ---
>   target/loongarch/helper.h | 64 +++++++++++++++++++--------------------
>   1 file changed, 32 insertions(+), 32 deletions(-)

That's one solution, though it may perform less well.

The other is to remove cpu_fcsr0, and instead access that value with explicit loads and 
stores in the two (!) instructions that use that tcg temporary.


r~


  reply	other threads:[~2022-08-06 16:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-06 13:34 [PATCH] target/loongarch: Fix "movfcsr2gr" gets wrong value Qi Hu
2022-08-06 16:15 ` Richard Henderson [this message]
2022-08-07  3:22   ` huqi

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=26f5be99-e9be-df9d-be50-1a2f2cd64986@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=chenfeiyang@loongson.cn \
    --cc=gaosong@loongson.cn \
    --cc=huqi@loongson.cn \
    --cc=qemu-devel@nongnu.org \
    --cc=yangxiaojuan@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).