[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] target/loongarch: Fix "movfcsr2gr" gets wrong value
From: |
huqi |
Subject: |
Re: [PATCH] target/loongarch: Fix "movfcsr2gr" gets wrong value |
Date: |
Sun, 7 Aug 2022 11:22:03 +0800 |
> On Aug 7, 2022, at 00:18, Richard Henderson <richard.henderson@linaro.org>
> wrote:
>
> 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.
>
This solution is better. Thanks for your advice. :)
Qi
>
> r~