Files
c3c/test/test_suite/abi/regcall_expand.c3t

54 lines
1.3 KiB
C

// #target: x64-mingw
module test;
extern fn void printf(char*, ...);
struct Foo
{
float[2] x;
}
fn void test(Foo x) @regcall
{
}
fn void main()
{
test(Foo { });
}
/* #expect: test.ll
%Foo = type { [2 x float] }
@Foo = linkonce_odr constant i8 1
; Function Attrs: nounwind
declare void @printf(i8*, ...) #0
; Function Attrs: nounwind
define x86_regcallcc void @test.test(float %0, float %1) #0 {
entry:
%x = alloca %Foo, align 4
%2 = getelementptr inbounds %Foo, %Foo* %x, i32 0, i32 0
%3 = getelementptr inbounds [2 x float], [2 x float]* %2, i64 0, i64 0
store float %0, float* %3, align 4
%4 = getelementptr inbounds [2 x float], [2 x float]* %2, i64 0, i64 1
store float %1, float* %4, align 4
ret void
}
; Function Attrs: nounwind
define void @main() #0 {
entry:
%literal = alloca %Foo, align 4
%0 = bitcast %Foo* %literal to i8*
call void @llvm.memset.p0i8.i64(i8* align 4 %0, i8 0, i64 8, i1 false)
%1 = getelementptr inbounds %Foo, %Foo* %literal, i32 0, i32 0
%2 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 0
%loadexpanded = load float, float* %2, align 4
%3 = getelementptr inbounds [2 x float], [2 x float]* %1, i64 0, i64 1
%loadexpanded1 = load float, float* %3, align 4
call x86_regcallcc void @test.test(float %loadexpanded, float %loadexpanded1)
ret void
}