I hadn't realized before that the filetest backend for `test vcode` is doing essentially what `compile` is doing, but for new (`MachInst`) backends: it is just getting a disassembly and running it through filecheck. There's no reason not to reuse `test compile` for the AArch64 tests as well. This was motivated by the desire to have "this IR compiles successfully" tests work on both x86 and AArch64. It seems this should work fine by adding multiple `target` directives when a test case should be compile-tested on multiple architectures.
70 lines
1.3 KiB
Plaintext
70 lines
1.3 KiB
Plaintext
test compile
|
|
target aarch64
|
|
|
|
function %add8(i8, i8) -> i8 {
|
|
block0(v0: i8, v1: i8):
|
|
v2 = iadd.i8 v0, v1
|
|
return v2
|
|
}
|
|
|
|
; check: stp fp, lr, [sp, #-16]!
|
|
; nextln: mov fp, sp
|
|
; nextln: add w0, w0, w1
|
|
; nextln: mov sp, fp
|
|
; nextln: ldp fp, lr, [sp], #16
|
|
; nextln: ret
|
|
|
|
function %add16(i16, i16) -> i16 {
|
|
block0(v0: i16, v1: i16):
|
|
v2 = iadd.i16 v0, v1
|
|
return v2
|
|
}
|
|
|
|
; check: stp fp, lr, [sp, #-16]!
|
|
; nextln: mov fp, sp
|
|
; nextln: add w0, w0, w1
|
|
; nextln: mov sp, fp
|
|
; nextln: ldp fp, lr, [sp], #16
|
|
; nextln: ret
|
|
|
|
function %add32(i32, i32) -> i32 {
|
|
block0(v0: i32, v1: i32):
|
|
v2 = iadd.i32 v0, v1
|
|
return v2
|
|
}
|
|
|
|
; check: stp fp, lr, [sp, #-16]!
|
|
; nextln: mov fp, sp
|
|
; nextln: add w0, w0, w1
|
|
; nextln: mov sp, fp
|
|
; nextln: ldp fp, lr, [sp], #16
|
|
; nextln: ret
|
|
|
|
function %add32_8(i32, i8) -> i32 {
|
|
block0(v0: i32, v1: i8):
|
|
v2 = sextend.i32 v1
|
|
v3 = iadd.i32 v0, v2
|
|
return v3
|
|
}
|
|
|
|
; check: stp fp, lr, [sp, #-16]!
|
|
; nextln: mov fp, sp
|
|
; nextln: add w0, w0, w1, SXTB
|
|
; nextln: mov sp, fp
|
|
; nextln: ldp fp, lr, [sp], #16
|
|
; nextln: ret
|
|
|
|
function %add64_32(i64, i32) -> i64 {
|
|
block0(v0: i64, v1: i32):
|
|
v2 = sextend.i64 v1
|
|
v3 = iadd.i64 v0, v2
|
|
return v3
|
|
}
|
|
|
|
; check: stp fp, lr, [sp, #-16]!
|
|
; nextln: mov fp, sp
|
|
; nextln: add x0, x0, x1, SXTW
|
|
; nextln: mov sp, fp
|
|
; nextln: ldp fp, lr, [sp], #16
|
|
; nextln: ret
|