This PR switches the default backend on x86, for both the `cranelift-codegen` crate and for Wasmtime, to the new (`MachInst`-style, `VCode`-based) backend that has been under development and testing for some time now. The old backend is still available by default in builds with the `old-x86-backend` feature, or by requesting `BackendVariant::Legacy` from the appropriate APIs. As part of that switch, it adds some more runtime-configurable plumbing to the testing infrastructure so that tests can be run using the appropriate backend. `clif-util test` is now capable of parsing a backend selector option from filetests and instantiating the correct backend. CI has been updated so that the old x86 backend continues to run its tests, just as we used to run the new x64 backend separately. At some point, we will remove the old x86 backend entirely, once we are satisfied that the new backend has not caused any unforeseen issues and we do not need to revert.
113 lines
2.2 KiB
Plaintext
113 lines
2.2 KiB
Plaintext
test regalloc
|
|
target x86_64 legacy haswell
|
|
|
|
; regex: V=v\d+
|
|
; regex: BB=block\d+
|
|
|
|
; Filed as https://github.com/bytecodealliance/cranelift/issues/208
|
|
;
|
|
; The verifier complains about a branch argument that is not in the same virtual register as the
|
|
; corresponding block argument.
|
|
;
|
|
; The problem was the reload pass rewriting block arguments on "brnz v9, block3(v9)"
|
|
|
|
function %pr208(i64 vmctx [%rdi]) system_v {
|
|
gv1 = vmctx
|
|
gv0 = iadd_imm.i64 gv1, -8
|
|
heap0 = static gv0, min 0, bound 0x5000, offset_guard 0x0040_0000
|
|
sig0 = (i64 vmctx [%rdi]) -> i32 [%rax] system_v
|
|
sig1 = (i64 vmctx [%rdi], i32 [%rsi]) system_v
|
|
fn0 = u0:1 sig0
|
|
fn1 = u0:3 sig1
|
|
|
|
block0(v0: i64):
|
|
v1 = iconst.i32 0
|
|
v2 = call fn0(v0)
|
|
v20 = iconst.i32 0x4ffe
|
|
v16 = icmp uge v2, v20
|
|
brz v16, block5
|
|
jump block9
|
|
|
|
block9:
|
|
trap heap_oob
|
|
|
|
block5:
|
|
v17 = uextend.i64 v2
|
|
v18 = iadd_imm.i64 v0, -8
|
|
v19 = load.i64 v18
|
|
v3 = iadd v19, v17
|
|
v4 = load.i32 v3
|
|
v21 = iconst.i32 0
|
|
v5 = icmp eq v4, v21
|
|
v6 = bint.i32 v5
|
|
brnz v6, block2
|
|
jump block3(v4)
|
|
|
|
; check: block5:
|
|
; check: jump block3(v4)
|
|
; check: $(splitEdge=$BB):
|
|
; nextln: jump block3(v9)
|
|
|
|
block3(v7: i32):
|
|
call fn1(v0, v7)
|
|
v26 = iconst.i32 0x4ffe
|
|
v22 = icmp uge v7, v26
|
|
brz v22, block6
|
|
jump block10
|
|
|
|
block10:
|
|
trap heap_oob
|
|
|
|
block6:
|
|
v23 = uextend.i64 v7
|
|
v24 = iadd_imm.i64 v0, -8
|
|
v25 = load.i64 v24
|
|
v8 = iadd v25, v23
|
|
v9 = load.i32 v8+56
|
|
; check: v9 = spill
|
|
; check: brnz $V, $splitEdge
|
|
brnz v9, block3(v9)
|
|
jump block4
|
|
|
|
block4:
|
|
jump block2
|
|
|
|
block2:
|
|
v10 = iconst.i32 0
|
|
v31 = iconst.i32 0x4ffe
|
|
v27 = icmp uge v10, v31
|
|
brz v27, block7
|
|
jump block11
|
|
|
|
block11:
|
|
trap heap_oob
|
|
|
|
block7:
|
|
v28 = uextend.i64 v10
|
|
v29 = iadd_imm.i64 v0, -8
|
|
v30 = load.i64 v29
|
|
v11 = iadd v30, v28
|
|
v12 = load.i32 v11+12
|
|
call fn1(v0, v12)
|
|
v13 = iconst.i32 0
|
|
v36 = iconst.i32 0x4ffe
|
|
v32 = icmp uge v13, v36
|
|
brz v32, block8
|
|
jump block12
|
|
|
|
block12:
|
|
trap heap_oob
|
|
|
|
block8:
|
|
v33 = uextend.i64 v13
|
|
v34 = iadd_imm.i64 v0, -8
|
|
v35 = load.i64 v34
|
|
v14 = iadd v35, v33
|
|
v15 = load.i32 v14+12
|
|
call fn1(v0, v15)
|
|
jump block1
|
|
|
|
block1:
|
|
return
|
|
}
|