Files
wasmtime/cranelift/filetests/filetests/isa/aarch64/bti.clif
Trevor Elliott 15fe9c7c93 Inline jump tables in parsed br_table instructions (#5755)
As jump tables are used by at most one br_table instruction, inline their definition in those instructions instead of requiring them to be declared as function-level metadata.
2023-02-09 14:24:04 -08:00

110 lines
1.8 KiB
Plaintext

test compile precise-output
set unwind_info=false
target aarch64 use_bti
function %f1(i32) -> i32 {
block0(v0: i32):
br_table v0, block4, [block1, block2, block3]
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
}
; bti c
; block0:
; emit_island 44
; subs wzr, w0, #3
; b.hs label1 ; csel x15, xzr, x0, hs ; csdb ; adr x14, pc+16 ; ldrsw x15, [x14, x15, uxtw #2] ; add x14, x14, x15 ; br x14 ; jt_entries [Label(MachLabel(3)), Label(MachLabel(5)), Label(MachLabel(7))]
; block1:
; movz w5, #4
; b label2
; block2:
; b label9
; block3:
; bti j
; movz w5, #1
; b label4
; block4:
; b label9
; block5:
; bti j
; movz w5, #2
; b label6
; block6:
; b label9
; block7:
; bti j
; movz w5, #3
; b label8
; block8:
; b label9
; block9:
; add w0, w0, w5
; ret
function %f2(i64) -> i64 {
block0(v0: i64):
v1 = ireduce.i32 v0
v2 = load.i64 notrap aligned table v0
br_table v1, block1, [block2]
block1:
return v2
block2:
v3 = iconst.i64 42
v4 = iadd.i64 v2, v3
return v4
}
; bti c
; block0:
; ldr x5, [x0]
; mov x8, x5
; emit_island 36
; subs wzr, w0, #1
; b.hs label1 ; csel x7, xzr, x0, hs ; csdb ; adr x6, pc+16 ; ldrsw x7, [x6, x7, uxtw #2] ; add x6, x6, x7 ; br x6 ; jt_entries [Label(MachLabel(2))]
; block1:
; mov x0, x8
; ret
; block2:
; bti j
; mov x0, x8
; add x0, x0, #42
; ret
function %f3(i64) -> i64 {
fn0 = %g(i64) -> i64
block0(v0: i64):
v1 = call fn0(v0)
return v1
}
; bti c
; stp fp, lr, [sp, #-16]!
; mov fp, sp
; block0:
; ldr x3, 8 ; b 12 ; data TestCase(%g) + 0
; blr x3
; ldp fp, lr, [sp], #16
; ret