Fix treatment of out-of-range values in switch csa.
--HG-- branch : dtrg-videocore
This commit is contained in:
parent
86c6fa2f1e
commit
3e0123ca03
1 changed files with 7 additions and 4 deletions
|
@ -17,17 +17,20 @@
|
||||||
add r0, gp
|
add r0, gp
|
||||||
|
|
||||||
ld r2, 4 (r0) ! check lower bound
|
ld r2, 4 (r0) ! check lower bound
|
||||||
cmp r1, r2
|
|
||||||
mov.lo r1, r2 ! r1 = min(r1, r2)
|
b.lo r1, r2, default ! jump to default if r1 < r2
|
||||||
|
|
||||||
sub r1, r2 ! adjust value to be 0-based
|
sub r1, r2 ! adjust value to be 0-based
|
||||||
|
|
||||||
ld r2, 8 (r0) ! check upper bound
|
ld r2, 8 (r0) ! check upper bound
|
||||||
cmp r1, r2
|
b.hi r1, r2, default ! jump to default if r1 > r2
|
||||||
mov.hi r1, r2 ! r1 = max(r1, r2)
|
|
||||||
|
|
||||||
add r1, #3
|
add r1, #3
|
||||||
|
go:
|
||||||
ld r1, (r0, r1) ! load destination address
|
ld r1, (r0, r1) ! load destination address
|
||||||
add r1, gp
|
add r1, gp
|
||||||
b r1 ! ...and go
|
b r1 ! ...and go
|
||||||
|
|
||||||
|
default:
|
||||||
|
mov r1, #0 ! index of default value
|
||||||
|
b go
|
||||||
|
|
Loading…
Reference in a new issue