Files
c3c/test/test_suite/abi/union_x64.c3t
2021-11-16 17:46:44 +01:00

39 lines
909 B
C

// #target: x64-darwin
module unionx64;
union Foo
{
long a;
char[12] b;
}
extern fn void hello2(Foo f);
fn void hello(Foo f)
{
hello2(f);
}
// #expect: unionx64.ll
%Foo = type { i64, [8 x i8] }
declare void @hello2(i64, i64) #0
define void @unionx64.hello(i64 %0, i64 %1) #0 {
entry:
%f = alloca %Foo, align 8
%pair = bitcast %Foo* %f to { i64, i64 }*
%2 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %pair, i32 0, i32 0
store i64 %0, i64* %2, align 8
%3 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %pair, i32 0, i32 1
store i64 %1, i64* %3, align 8
%4 = bitcast %Foo* %f to { i64, i64 }*
%5 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 0
%lo = load i64, i64* %5, align 8
%6 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 1
%hi = load i64, i64* %6, align 8
call void @hello2(i64 %lo, i64 %hi)
ret void
}