Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests/tcg/tricore: Add recursion test for CSAs
Signed-off-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Message-Id: <20230526061946.54514-7-kbastian@mail.uni-paderborn.de>
  • Loading branch information
bkoppelmann committed Jun 7, 2023
1 parent 12b95dc commit e926c94
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/tcg/tricore/Makefile.softmmu-target
Expand Up @@ -4,7 +4,7 @@ C_TESTS_PATH = $(TESTS_PATH)/c

LDFLAGS = -T$(TESTS_PATH)/link.ld --mcpu=tc162
ASFLAGS = -mtc162
CFLAGS = -mtc162 -c
CFLAGS = -mtc162 -c -I$(TESTS_PATH)

TESTS += test_abs.asm.tst
TESTS += test_bmerge.asm.tst
Expand All @@ -23,6 +23,7 @@ TESTS += test_msub.asm.tst
TESTS += test_muls.asm.tst

TESTS += test_boot_to_main.c.tst
TESTS += test_context_save_areas.c.tst

QEMU_OPTS += -M tricore_testboard -cpu tc27x -nographic -kernel

Expand Down
15 changes: 15 additions & 0 deletions tests/tcg/tricore/c/test_context_save_areas.c
@@ -0,0 +1,15 @@
#include "testdev_assert.h"

static int fib(int n)
{
if (n == 1 || n == 2) {
return 1;
}
return fib(n - 2) + fib(n - 1);
}

int main(int argc, char **argv)
{
testdev_assert(fib(10) == 55);
return 0;
}

0 comments on commit e926c94

Please sign in to comment.