Added test reproducing an issue with constants, jumptables and traps.

This commit is contained in:
gibbed 2015-06-07 06:48:23 -05:00
parent 54f03529db
commit 43b0cd6eae
1 changed files with 45 additions and 0 deletions

View File

@ -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