From b9ec52188f1eafb2901d37a57727bbf1d8bbe3ca Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Thu, 21 Mar 2019 20:22:03 -0700 Subject: [PATCH 1/3] target/xtensa: fix break_dependency for repeated resources break_dependency incorrectly handles the case of dependency on an opcode that references the same register multiple times. E.g. the following instruction is translated incorrectly: { or a2, a3, a3 ; or a3, a2, a2 } This happens because resource indices of both dependency graph nodes are incremented, and a copy for the second instance of the same register in the ending node is not done. Only increment resource index of the ending node of the dependency. Add test. Signed-off-by: Max Filippov --- target/xtensa/translate.c | 1 - tests/tcg/xtensa/test_flix.S | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index 77bc04d6b0..65561d2c49 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -1041,7 +1041,6 @@ static bool break_dependency(struct slot_prop *a, copy[n].resource = b->in[j].resource; copy[n].arg = b->arg + index; ++n; - ++i; ++j; rv = true; } diff --git a/tests/tcg/xtensa/test_flix.S b/tests/tcg/xtensa/test_flix.S index 7c259e7018..7af06b2b88 100644 --- a/tests/tcg/xtensa/test_flix.S +++ b/tests/tcg/xtensa/test_flix.S @@ -55,6 +55,23 @@ test sum .previous test_end +test rep_dependency + + { + movi a2, 1 + movi a3, 2 + nop + } + { + or a2, a3, a3 + or a3, a2, a2 + nop + } + assert eqi, a2, 2 + assert eqi, a3, 1 + +test_end + #endif test_suite_end From 393cf60bf75541e1090b1573ce88d6d2b9209c2a Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Fri, 22 Mar 2019 12:42:51 -0700 Subject: [PATCH 2/3] target/xtensa: don't announce exit simcall Don't announce that exit simcall has been invoked: this is just noise. Reviewed-by: Richard Henderson Signed-off-by: Max Filippov --- target/xtensa/xtensa-semi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/target/xtensa/xtensa-semi.c b/target/xtensa/xtensa-semi.c index 2f76216276..5f5ce4f344 100644 --- a/target/xtensa/xtensa-semi.c +++ b/target/xtensa/xtensa-semi.c @@ -202,7 +202,6 @@ void HELPER(simcall)(CPUXtensaState *env) switch (regs[2]) { case TARGET_SYS_exit: - qemu_log("exit(%d) simcall\n", regs[3]); exit(regs[3]); break; From bc19449acc2e05854118a47cdf96c1e86b30740d Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Fri, 22 Mar 2019 12:49:17 -0700 Subject: [PATCH 3/3] tests/tcg/xtensa: clean up test set Drop test_fail: we know that exit simcall works. Now that it's not run automatically there's no point in keeping it. Drop test_pipeline: we're not modeling pipeline, we don't control ccount and there's no plan to do so. Enable test_boolean: it won't break on cores without boolean option, it will do testing on cores with boolean option. Signed-off-by: Max Filippov --- tests/tcg/xtensa/Makefile.softmmu-target | 2 +- tests/tcg/xtensa/test_fail.S | 9 -- tests/tcg/xtensa/test_pipeline.S | 157 ----------------------- 3 files changed, 1 insertion(+), 167 deletions(-) delete mode 100644 tests/tcg/xtensa/test_fail.S delete mode 100644 tests/tcg/xtensa/test_pipeline.S diff --git a/tests/tcg/xtensa/Makefile.softmmu-target b/tests/tcg/xtensa/Makefile.softmmu-target index 86bb47db77..8212d96b81 100644 --- a/tests/tcg/xtensa/Makefile.softmmu-target +++ b/tests/tcg/xtensa/Makefile.softmmu-target @@ -8,7 +8,7 @@ XTENSA_SRC = $(SRC_PATH)/tests/tcg/xtensa XTENSA_ALL = $(filter-out $(XTENSA_SRC)/linker.ld.S,$(wildcard $(XTENSA_SRC)/*.S)) XTENSA_TESTS = $(patsubst $(XTENSA_SRC)/%.S, %, $(XTENSA_ALL)) # Filter out common blobs and broken tests -XTENSA_BROKEN_TESTS = crt vectors test_boolean test_pipeline test_fail +XTENSA_BROKEN_TESTS = crt vectors XTENSA_USABLE_TESTS = $(filter-out $(XTENSA_BROKEN_TESTS), $(XTENSA_TESTS)) # add to the list of tests diff --git a/tests/tcg/xtensa/test_fail.S b/tests/tcg/xtensa/test_fail.S deleted file mode 100644 index 1c26d50790..0000000000 --- a/tests/tcg/xtensa/test_fail.S +++ /dev/null @@ -1,9 +0,0 @@ -#include "macros.inc" - -test_suite fail - -test fail - test_fail -test_end - -test_suite_end diff --git a/tests/tcg/xtensa/test_pipeline.S b/tests/tcg/xtensa/test_pipeline.S deleted file mode 100644 index f418c11974..0000000000 --- a/tests/tcg/xtensa/test_pipeline.S +++ /dev/null @@ -1,157 +0,0 @@ -#include "macros.inc" - -.purgem test -.macro test name - movi a2, 1f - movi a3, 99f -0: - ipf a2, 0 - ipf a2, 4 - ipf a2, 8 - ipf a2, 12 - addi a2, a2, 16 - blt a2, a3, 0b - j 1f - .align 4 -1: -.endm - -test_suite pipeline - -test register_no_stall - rsr a3, ccount - add a5, a6, a6 - add a6, a5, a5 - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 3 -test_end - -test register_stall - l32i a5, a1, 0 /* data cache preload */ - nop - rsr a3, ccount - l32i a5, a1, 0 - add a6, a5, a5 /* M-to-E interlock */ - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 4 -test_end - -test j0_stall - rsr a3, ccount - j 1f /* E + 2-cycle penalty */ -1: - rsr a4, ccount /* E */ - sub a3, a4, a3 - assert eqi, a3, 4 -test_end - -test j1_stall - rsr a3, ccount - j 1f - nop -1: - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 4 -test_end - -test j5_stall - rsr a3, ccount - j 1f - nop - nop - nop - nop - nop -1: - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 4 -test_end - -test b_no_stall - movi a5, 1 - rsr a3, ccount - beqi a5, 2, 1f - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 2 -1: -test_end - -test b1_stall - movi a5, 1 - rsr a3, ccount - beqi a5, 1, 1f - nop -1: - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 4 -test_end - -test b5_stall - movi a5, 1 - rsr a3, ccount - beqi a5, 1, 1f - nop - nop - nop - nop - nop -1: - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 4 -test_end - -/* PS *SYNC */ - -test ps_dsync - rsr a5, ps - isync - rsr a3, ccount - wsr a5, ps - dsync - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 5 -test_end - -test ps_esync - rsr a5, ps - isync - rsr a3, ccount - wsr a5, ps - esync - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 5 -test_end - -test ps_rsync - rsr a5, ps - isync - rsr a3, ccount - wsr a5, ps - rsync - rsr a4, ccount - sub a3, a4, a3 - assert eqi, a3, 5 -test_end - -test ps_isync - rsr a5, ps - isync - rsr a3, ccount - wsr a5, ps - isync - rsr a4, ccount - sub a3, a4, a3 - movi a4, 9 - assert eq, a3, a4 -test_end - -test_suite_end