mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
54 lines
1.3 KiB
C
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
|
|
}
|