Advance the insertion cursor after replacinf an instruction.
When expanding iadd_cout, the original instruction is replaced with an iadd, and an icmp is inserted after the iadd. Make sure we advance the insertion position after replacing iadd_cout so the icmp gets inserted *after* iadd.
This commit is contained in:
18
cranelift/filetests/isa/riscv/expand-i32.cton
Normal file
18
cranelift/filetests/isa/riscv/expand-i32.cton
Normal file
@@ -0,0 +1,18 @@
|
||||
; Test the legalization of i32 instructions that don't have RISC-V versions.
|
||||
test legalizer
|
||||
|
||||
set is_64bit=0
|
||||
isa riscv supports_m=1
|
||||
|
||||
set is_64bit=1
|
||||
isa riscv supports_m=1
|
||||
|
||||
; regex: V=vx?\d+
|
||||
|
||||
function carry_out(i32, i32) -> i32, b1 {
|
||||
ebb0(v1: i32, v2: i32):
|
||||
v3, v4 = iadd_cout v1, v2
|
||||
return v3, v4
|
||||
}
|
||||
; check: $v3 = iadd $v1, $v2
|
||||
; check: $(cout=$V) = icmp ult, $v3, $v1
|
||||
Reference in New Issue
Block a user