Implement passing arguments by ref for win64 ABI

This commit is contained in:
teapotd
2020-05-25 20:34:50 +02:00
parent 94380bf2b7
commit 759cc3e751
6 changed files with 128 additions and 10 deletions

View File

@@ -117,6 +117,20 @@ block0(v0: i64, v1: i64):
}
; check: function %ret_val_i128(i64 [%rdx], i64 [%r8], i64 sret [%rcx], i64 fp [%rbp]) -> i64 sret [%rax], i64 fp [%rbp] windows_fastcall {
; check if i128 is passed by reference
function %i128_arg(i128) windows_fastcall {
block0(v0: i128):
return
}
; check: function %i128_arg(i64 ptr [%rcx], i64 fp [%rbp]) -> i64 fp [%rbp] windows_fastcall {
; check if vector types are passed by reference
function %i32x4_arg(i32x4) windows_fastcall {
block0(v0: i32x4):
return
}
; check: function %i32x4_arg(i64 ptr [%rcx], i64 fp [%rbp]) -> i64 fp [%rbp] windows_fastcall {
function %internal_stack_arg_function_call(i64) -> i64 windows_fastcall {
fn0 = %foo(i64, i64, i64, i64) -> i64 windows_fastcall
fn1 = %foo2(i64, i64, i64, i64) -> i64 windows_fastcall

View File

@@ -0,0 +1,31 @@
test legalizer
target x86_64
function %legalize_entry(i128) -> i64 windows_fastcall {
block0(v0: i128):
v1, v2 = isplit v0
return v2
}
; check: function %legalize_entry(i64 ptr [%rcx]) -> i64 [%rax] windows_fastcall {
; nextln: block0(v3: i64):
; nextln: v4 = load.i64 v3
; nextln: v1 -> v4
; nextln: v5 = load.i64 v3+8
; nextln: v2 -> v5
; nextln: v0 = iconcat v4, v5
; nextln: return v2
function %legalize_call() {
fn0 = %foo(i32x4) windows_fastcall
block0:
v0 = vconst.i32x4 [1 2 3 4]
call fn0(v0)
return
}
; check: ss0 = explicit_slot 16
; check: sig0 = (i64 ptr [%rcx]) windows_fastcall
; check: v0 = vconst.i32x4 const0
; nextln: v1 = stack_addr.i64 ss0
; nextln: store v0, v1
; nextln: v2 = func_addr.i64 fn0
; nextln: call_indirect sig0, v2(v1)