* cranelift: Restrict `br_table` to `i32` indices In #4498 it was proposed that we should only accept `i32` indices to `br_table`. The rationale for this is that larger types lead the users to a false sense of flexibility (since we don't support jump tables larger than u32's), and narrower types are not well tested paths that would be safer if we removed them. * cranelift: Reduce directly from i128 to i32 in Switch
61 lines
858 B
Plaintext
61 lines
858 B
Plaintext
test compile precise-output
|
|
target s390x
|
|
|
|
function %f(i32) -> i32 {
|
|
jt0 = jump_table [block1, block2, block3]
|
|
|
|
block0(v0: i32):
|
|
br_table v0, block4, jt0
|
|
|
|
block1:
|
|
v1 = iconst.i32 1
|
|
jump block5(v1)
|
|
|
|
block2:
|
|
v2 = iconst.i32 2
|
|
jump block5(v2)
|
|
|
|
block3:
|
|
v3 = iconst.i32 3
|
|
jump block5(v3)
|
|
|
|
block4:
|
|
v4 = iconst.i32 4
|
|
jump block5(v4)
|
|
|
|
block5(v5: i32):
|
|
v6 = iadd.i32 v0, v5
|
|
return v6
|
|
}
|
|
|
|
; block0:
|
|
; llgfr %r3, %r2
|
|
; clgfi %r3, 3
|
|
; jghe label1
|
|
; sllg %r3, %r3, 2
|
|
; larl %r1, 14 ; agf %r1, 0(%r1, %r3) ; br %r1 ; jt_entries label3 label5 label7
|
|
; block1:
|
|
; lhi %r5, 4
|
|
; jg label2
|
|
; block2:
|
|
; jg label9
|
|
; block3:
|
|
; lhi %r5, 1
|
|
; jg label4
|
|
; block4:
|
|
; jg label9
|
|
; block5:
|
|
; lhi %r5, 2
|
|
; jg label6
|
|
; block6:
|
|
; jg label9
|
|
; block7:
|
|
; lhi %r5, 3
|
|
; jg label8
|
|
; block8:
|
|
; jg label9
|
|
; block9:
|
|
; ar %r2, %r5
|
|
; br %r14
|
|
|