From 43b0cd6eaea6ab23ad9d29615d01d8705b064ee5 Mon Sep 17 00:00:00 2001 From: gibbed Date: Sun, 7 Jun 2015 06:48:23 -0500 Subject: [PATCH] Added test reproducing an issue with constants, jumptables and traps. --- .../cpu/frontend/test/jumptable_constants.s | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/xenia/cpu/frontend/test/jumptable_constants.s diff --git a/src/xenia/cpu/frontend/test/jumptable_constants.s b/src/xenia/cpu/frontend/test/jumptable_constants.s new file mode 100644 index 000000000..30b5d3d6a --- /dev/null +++ b/src/xenia/cpu/frontend/test/jumptable_constants.s @@ -0,0 +1,45 @@ +the_function: + cmpwi cr6, r3, 3 + bgt .case_3 + lis r12, .the_table@ha + addi r12, r12, .the_table@l + slwi r3, r3, 2 + lwzx r3, r12, r3 + mtspr ctr, r3 + bctr +.the_table: + .long .case_0 + .long .case_1 + .long .case_2 + .long .case_3 +.case_0: + li r11, 8 + b .the_divide +.case_1: + li r11, 16 + b .the_divide +.case_2: + li r11, 24 + b .the_divide +.case_3: + li r11, 32 +.the_divide: + extsw r11, r11 + tdllei r11, 0 + divdu r4, r4, r11 + blr + +test_jumptable_constants: + li r3, 0 + li r4, 1024 + bl the_function + li r3, 1 + li r4, 1024 + bl the_function + li r3, 2 + li r4, 1024 + bl the_function + li r3, 3 + li r4, 1024 + bl the_function + blr