qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] target/loongarch: Fix "movfcsr2gr" gets wrong value


From: Richard Henderson
Subject: Re: [PATCH] target/loongarch: Fix "movfcsr2gr" gets wrong value
Date: Sat, 6 Aug 2022 09:15:34 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0

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 via email to

[Prev in Thread] Current Thread [Next in Thread]