qemu-e2k/tests/tcg/loongarch64/test_fcsr.c
Richard Henderson 10dcb08b03 target/loongarch: Remove cpu_fcsr0
All of the fpu operations are defined with TCG_CALL_NO_WG, but they
all modify FCSR0.  The most efficient way to fix this is to remove
cpu_fcsr0, and instead use explicit load and store operations for the
two instructions that manipulate that value.

Acked-by: Qi Hu <huqi@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Reported-by: Feiyang Chen <chenfeiyang@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2022-08-08 19:42:53 -07:00

16 lines
279 B
C

#include <assert.h>
int main()
{
unsigned fcsr;
asm("movgr2fcsr $r0,$r0\n\t"
"movgr2fr.d $f0,$r0\n\t"
"fdiv.d $f0,$f0,$f0\n\t"
"movfcsr2gr %0,$r0"
: "=r"(fcsr) : : "f0");
assert(fcsr & (16 << 16)); /* Invalid */
return 0;
}