From d31b85c53063a91ca75e83581d9ce8638f1f0fe8 Mon Sep 17 00:00:00 2001 From: fridtjof Date: Fri, 22 Aug 2025 01:16:18 +0200 Subject: [PATCH] wip! tests: future branch tests --- tests/tcg/cr16c/test11-branches.S | 43 +++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/tcg/cr16c/test11-branches.S diff --git a/tests/tcg/cr16c/test11-branches.S b/tests/tcg/cr16c/test11-branches.S new file mode 100644 index 0000000000..29acb2547a --- /dev/null +++ b/tests/tcg/cr16c/test11-branches.S @@ -0,0 +1,43 @@ +#include "macros.inc" + +.global _start + +.text +_start: + /* Initialize registers */ + RESET + + movd $0x4000, (sp) +begin: + /* todo: test all addressing modes here somehow */ + + // registers + // register pairs + // immediate + // relative (disp variants) modes + // absolute + // (uh oh) index + /** BAL **/ + bal (ra), sub1 + + movw $0x1234, r1 + movw $0x4242, r2 + bal (ra), sub2 + EXPECT 0x1234, r1 + EXPECT 0x4242, r2 + + ENDING + FAIL_HANDLER + +sub1: + jump (ra) /* should return */ + FAIL + + +sub2: + PUSH $0x2, r1, ra + movw $-1, r1 + movw $-1, r2 + POPRET $0x2, r1, ra /* should return */ + FAIL +