Add fixed constraints for ABI arguments and return values.

We can start adding some real test cases for the move resolver now.
This commit is contained in:
Jakob Stoklund Olesen
2017-05-11 10:11:28 -07:00
parent 51fc887a5a
commit 663b50efcc
2 changed files with 98 additions and 19 deletions

View File

@@ -3,6 +3,8 @@ test regalloc
; We can add more ISAs once they have defined encodings.
isa riscv
; regex: RX=%x\d+
function add(i32, i32) {
ebb0(v1: i32, v2: i32):
v3 = iadd v1, v2
@@ -14,6 +16,27 @@ ebb0(v1: i32, v2: i32):
; Function with a dead argument.
function dead_arg(i32, i32) -> i32{
ebb0(v1: i32, v2: i32):
; not: regmove
; check: return $v1
return v1
}
; Return a value from a different register.
function move1(i32, i32) -> i32 {
ebb0(v1: i32, v2: i32):
; not: regmove
; check: regmove $v2, %x11 -> %x10
; nextln: return $v2
return v2
}
; Swap two registers.
function swap(i32, i32) -> i32, i32 {
ebb0(v1: i32, v2: i32):
; not: regmove
; check: regmove $v2, %x11 -> $(tmp=$RX)
; nextln: regmove $v1, %x10 -> %x11
; nextln: regmove $v2, $tmp -> %x10
; nextln: return $v2, $v1
return v2, v1
}