Files
c3c/test/test_suite/abi/regcall_expand.c3t
2023-01-11 18:00:08 +01:00

57 lines
1.5 KiB
C

// #target: mingw-x64
module test;
extern fn void printf(char*, ...);
struct Foo
{
float[2] x;
}
fn void test(Foo x) @regcall
{
}
fn int main()
{
test(Foo { });
return 0;
}
/* #expect: test.ll
%Foo = type { [2 x float] }
$"ct$test_Foo" = comdat any
@"ct$test_Foo" = linkonce constant %.introspect { i8 10, i64 8, i64 0, i64 1, [0 x i64] zeroinitializer }, comdat, align 8
declare void @printf(ptr, ...) #0
define x86_regcallcc void @test_test(float %0, float %1) #0 {
entry:
%x = alloca %Foo, align 4
%2 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0
%3 = getelementptr inbounds [2 x float], ptr %2, i64 0, i64 0
store float %0, ptr %3, align 4
%4 = getelementptr inbounds [2 x float], ptr %2, i64 0, i64 1
store float %1, ptr %4, align 4
ret void
}
; Function Attrs: nounwind
define i32 @main() #0 {
entry:
%literal = alloca %Foo, align 4
%0 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 0
%1 = getelementptr inbounds [2 x float], ptr %0, i64 0, i64 0
store float 0.000000e+00, ptr %1, align 4
%2 = getelementptr inbounds [2 x float], ptr %0, i64 0, i64 1
store float 0.000000e+00, ptr %2, align 4
%3 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 0
%4 = getelementptr inbounds [2 x float], ptr %3, i64 0, i64 0
%loadexpanded = load float, ptr %4, align 4
%5 = getelementptr inbounds [2 x float], ptr %3, i64 0, i64 1
%loadexpanded1 = load float, ptr %5, align 4
call x86_regcallcc void @test_test(float %loadexpanded, float %loadexpanded1)
ret i32 0
}