aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg
diff options
context:
space:
mode:
authorBastian Koppelmann <kbastian@mail.uni-paderborn.de>2023-02-03 14:21:32 +0100
committerBastian Koppelmann <kbastian@mail.uni-paderborn.de>2023-02-08 10:02:46 +0100
commit6e34f54d88184b25db4fbc4dd1665d9be1a9e21c (patch)
tree8c8342f4f303750d146f1009e529b4ec76214bda /tests/tcg
parent77eb0085c8fe48e77f845d9db0d3c4c4ccf7c4f1 (diff)
downloadqemu-6e34f54d88184b25db4fbc4dd1665d9be1a9e21c.zip
qemu-6e34f54d88184b25db4fbc4dd1665d9be1a9e21c.tar.gz
qemu-6e34f54d88184b25db4fbc4dd1665d9be1a9e21c.tar.bz2
tests/tcg/tricore: Add test for ld.h
this exercises the error reported in https://gitlab.com/qemu-project/qemu/-/issues/652. Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Message-Id: <20230203132132.511254-1-kbastian@mail.uni-paderborn.de> Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Diffstat (limited to 'tests/tcg')
-rw-r--r--tests/tcg/tricore/Makefile.softmmu-target1
-rw-r--r--tests/tcg/tricore/macros.h13
-rw-r--r--tests/tcg/tricore/test_ld_h.S15
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/tcg/tricore/Makefile.softmmu-target b/tests/tcg/tricore/Makefile.softmmu-target
index b6c19db..d2446af 100644
--- a/tests/tcg/tricore/Makefile.softmmu-target
+++ b/tests/tcg/tricore/Makefile.softmmu-target
@@ -14,6 +14,7 @@ TESTS += test_ftoi.tst
TESTS += test_imask.tst
TESTS += test_insert.tst
TESTS += test_ld_bu.tst
+TESTS += test_ld_h.tst
TESTS += test_madd.tst
TESTS += test_msub.tst
TESTS += test_muls.tst
diff --git a/tests/tcg/tricore/macros.h b/tests/tcg/tricore/macros.h
index 109ef62..ec4f5bf 100644
--- a/tests/tcg/tricore/macros.h
+++ b/tests/tcg/tricore/macros.h
@@ -21,6 +21,7 @@
#define DREG_TEMP %d11
#define DREG_TEST_NUM %d14
#define DREG_CORRECT_RESULT %d15
+#define DREG_CORRECT_RESULT_2 %d13
#define AREG_ADDR %a0
#define AREG_CORRECT_RESULT %a3
@@ -79,6 +80,18 @@ test_ ## num: \
LI(DREG_CORRECT_RESULT, addr_result) \
jne DREG_CALC_RESULT, DREG_CORRECT_RESULT, fail;
+#define TEST_LD_SRO(insn, num, result, addr_result, ld_pattern) \
+test_ ## num: \
+ LIA(AREG_ADDR, test_data) \
+ insn %d15, ld_pattern; \
+ LI(DREG_CORRECT_RESULT_2, result) \
+ mov DREG_TEST_NUM, num; \
+ jne %d15, DREG_CORRECT_RESULT_2, fail; \
+ mov.d DREG_CALC_RESULT, AREG_ADDR; \
+ LI(DREG_CORRECT_RESULT, addr_result) \
+ jne DREG_CALC_RESULT, DREG_CORRECT_RESULT, fail;
+
+
/* Actual test case type
* e.g inst %dX, %dY -> TEST_D_D
* inst %dX, %dY, %dZ -> TEST_D_DD
diff --git a/tests/tcg/tricore/test_ld_h.S b/tests/tcg/tricore/test_ld_h.S
new file mode 100644
index 0000000..d3c157a
--- /dev/null
+++ b/tests/tcg/tricore/test_ld_h.S
@@ -0,0 +1,15 @@
+#include "macros.h"
+.data
+test_data:
+ .word 0xaffedead
+ .word 0x001122ff
+.text
+.global _start
+_start:
+# expect. addr reg val after load
+# insn num expect. load value | pattern for loading
+# | | | | |
+ TEST_LD (ld.h, 1, 0xffffaffe, MEM_BASE_ADDR, [AREG_ADDR]2)
+ TEST_LD_SRO(ld.h, 2, 0x000022ff, MEM_BASE_ADDR, [AREG_ADDR]4)
+
+ TEST_PASSFAIL