cranelift: Add a conditional branch instruction with two targets (#5446)
Add a conditional branch instruction with two targets: brif. This instruction will eventually replace brz and brnz, as it encompasses the behavior of both. This PR also changes the InstructionData layout for instruction formats that hold BlockCall values, taking the same approach we use for Value arguments. This allows branch_destination to return a slice to the BlockCall values held in the instruction, rather than requiring that we pattern match on InstructionData to fetch the then/else blocks. Function generation for fuzzing has been updated to generate uses of brif, and I've run the cranelift-fuzzgen target locally for hours without triggering any new failures.
This commit is contained in:
@@ -98,6 +98,22 @@ function %jump_args2() {
|
||||
return
|
||||
}
|
||||
|
||||
function %brif_args() {
|
||||
block0:
|
||||
v0 = iconst.i16 10
|
||||
v1 = iconst.i16 10
|
||||
brif v0, block1(v1), block2(v1)
|
||||
; error: arg 0 (v1) has type i16, expected i64
|
||||
; error: mismatched argument count
|
||||
; error: arg 0 (v1) has type i16, expected f32
|
||||
|
||||
block1(v2: i64):
|
||||
return
|
||||
|
||||
block2(v3: f32, v4: i8):
|
||||
return
|
||||
}
|
||||
|
||||
function %bad_extend() {
|
||||
block0:
|
||||
v0 = iconst.i32 10
|
||||
|
||||
Reference in New Issue
Block a user