47 lines
1.1 KiB
Plaintext
47 lines
1.1 KiB
Plaintext
test regalloc
|
|
target riscv32 enable_e
|
|
|
|
; regex: V=v\d+
|
|
|
|
; Check that we can handle a function return value that got spilled.
|
|
function %spill_return() -> i32 {
|
|
fn0 = %foo() -> i32 system_v
|
|
|
|
ebb0:
|
|
v0 = call fn0()
|
|
; check: $(reg=$V) = call fn0
|
|
; check: v0 = spill $reg
|
|
v2 = call fn0()
|
|
; check: v2 = call fn0
|
|
return v0
|
|
; check: $(reload=$V) = fill v0
|
|
; check: return $reload
|
|
}
|
|
|
|
; Check that copies where the arg has been spilled are replaced with fills.
|
|
;
|
|
; RV32E has 6 registers for function arguments so the 7th, v6, will be placed
|
|
; on the stack.
|
|
function %spilled_copy_arg(i32, i32, i32, i32, i32, i32, i32) -> i32 {
|
|
|
|
ebb0(v0: i32, v1: i32, v2: i32, v3: i32, v4: i32, v5: i32, v6: i32):
|
|
; not: copy
|
|
; check: v10 = fill v6
|
|
v10 = copy v6
|
|
return v10
|
|
}
|
|
|
|
; Check that copies where the result has been spilled are replaced with spills.
|
|
;
|
|
; v1 is live across a call so it will be spilled.
|
|
function %spilled_copy_result(i32) -> i32 {
|
|
fn0 = %foo(i32)
|
|
|
|
ebb0(v0: i32):
|
|
; not: copy
|
|
; check: v1 = spill v0
|
|
v1 = copy v0
|
|
call fn0(v1)
|
|
return v1
|
|
}
|