[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/21] tests/tcg/loongarch64: Add fp comparison instructions test
From: |
Richard Henderson |
Subject: |
[PULL 14/21] tests/tcg/loongarch64: Add fp comparison instructions test |
Date: |
Tue, 19 Jul 2022 23:29:53 +0530 |
From: Song Gao <gaosong@loongson.cn>
Choose some instructions to test:
- FCMP.cond.S
- cond: ceq clt cle cne seq slt sle sne
Signed-off-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20220716085426.3098060-8-gaosong@loongson.cn>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
tests/tcg/loongarch64/test_fpcom.c | 37 +++++++++++++++++++++++++++
tests/tcg/loongarch64/Makefile.target | 1 +
2 files changed, 38 insertions(+)
create mode 100644 tests/tcg/loongarch64/test_fpcom.c
diff --git a/tests/tcg/loongarch64/test_fpcom.c
b/tests/tcg/loongarch64/test_fpcom.c
new file mode 100644
index 0000000000..9e81f767f9
--- /dev/null
+++ b/tests/tcg/loongarch64/test_fpcom.c
@@ -0,0 +1,37 @@
+#include <assert.h>
+
+#define TEST_COMP(N) \
+void test_##N(float fj, float fk) \
+{ \
+ int rd = 0; \
+ \
+ asm volatile("fcmp."#N".s $fcc6,%1,%2\n" \
+ "movcf2gr %0, $fcc6\n" \
+ : "=r"(rd) \
+ : "f"(fj), "f"(fk) \
+ : ); \
+ assert(rd == 1); \
+}
+
+TEST_COMP(ceq)
+TEST_COMP(clt)
+TEST_COMP(cle)
+TEST_COMP(cne)
+TEST_COMP(seq)
+TEST_COMP(slt)
+TEST_COMP(sle)
+TEST_COMP(sne)
+
+int main()
+{
+ test_ceq(0xff700102, 0xff700102);
+ test_clt(0x00730007, 0xff730007);
+ test_cle(0xff70130a, 0xff70130b);
+ test_cne(0x1238acde, 0xff71111f);
+ test_seq(0xff766618, 0xff766619);
+ test_slt(0xff78881c, 0xff78901d);
+ test_sle(0xff780b22, 0xff790b22);
+ test_sne(0xff7bcd25, 0xff7a26cf);
+
+ return 0;
+}
diff --git a/tests/tcg/loongarch64/Makefile.target
b/tests/tcg/loongarch64/Makefile.target
index 59d564725a..b320d9fd9c 100644
--- a/tests/tcg/loongarch64/Makefile.target
+++ b/tests/tcg/loongarch64/Makefile.target
@@ -13,5 +13,6 @@ LDFLAGS+=-lm
LOONGARCH64_TESTS = test_bit
LOONGARCH64_TESTS += test_div
LOONGARCH64_TESTS += test_fclass
+LOONGARCH64_TESTS += test_fpcom
TESTS += $(LOONGARCH64_TESTS)
--
2.34.1
- [PULL 04/21] target/loongarch/cpu: Fix coverity errors about excp_names, (continued)
- [PULL 04/21] target/loongarch/cpu: Fix coverity errors about excp_names, Richard Henderson, 2022/07/19
- [PULL 05/21] target/loongarch/tlb_helper: Fix coverity integer overflow error, Richard Henderson, 2022/07/19
- [PULL 06/21] target/loongarch/op_helper: Fix coverity cond_at_most error, Richard Henderson, 2022/07/19
- [PULL 07/21] target/loongarch/cpu: Fix cpucfg default value, Richard Henderson, 2022/07/19
- [PULL 08/21] fpu/softfloat: Add LoongArch specializations for pickNaN*, Richard Henderson, 2022/07/19
- [PULL 09/21] target/loongarch: Fix float_convd/float_convs test failing, Richard Henderson, 2022/07/19
- [PULL 11/21] tests/tcg/loongarch64: Add clo related instructions test, Richard Henderson, 2022/07/19
- [PULL 10/21] tests/tcg/loongarch64: Add float reference files, Richard Henderson, 2022/07/19
- [PULL 12/21] tests/tcg/loongarch64: Add div and mod related instructions test, Richard Henderson, 2022/07/19
- [PULL 13/21] tests/tcg/loongarch64: Add fclass test, Richard Henderson, 2022/07/19
- [PULL 14/21] tests/tcg/loongarch64: Add fp comparison instructions test,
Richard Henderson <=
- [PULL 16/21] hw/loongarch: Add fw_cfg table support, Richard Henderson, 2022/07/19
- [PULL 17/21] hw/loongarch: Add uefi bios loading support, Richard Henderson, 2022/07/19
- [PULL 15/21] tests/tcg/loongarch64: Add pcadd related instructions test, Richard Henderson, 2022/07/19
- [PULL 18/21] hw/loongarch: Add linux kernel booting support, Richard Henderson, 2022/07/19
- [PULL 19/21] hw/loongarch: Add smbios support, Richard Henderson, 2022/07/19
- [PULL 20/21] hw/loongarch: Add acpi ged support, Richard Henderson, 2022/07/19
- [PULL 21/21] hw/loongarch: Add fdt support, Richard Henderson, 2022/07/19
- Re: [PULL 00/21] loongarch patch queue, Peter Maydell, 2022/07/20