summaryrefslogtreecommitdiff
path: root/tests/tcg/loongarch64/test_fcsr.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tcg/loongarch64/test_fcsr.c')
-rw-r--r--tests/tcg/loongarch64/test_fcsr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/tcg/loongarch64/test_fcsr.c b/tests/tcg/loongarch64/test_fcsr.c
new file mode 100644
index 0000000000..ad3609eb99
--- /dev/null
+++ b/tests/tcg/loongarch64/test_fcsr.c
@@ -0,0 +1,15 @@
+#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;
+}