mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
38 lines
774 B
C
38 lines
774 B
C
// #target: macos-x64
|
|
|
|
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
|
|
%2 = getelementptr inbounds { i64, i64 }, ptr %f, i32 0, i32 0
|
|
store i64 %0, ptr %2, align 8
|
|
%3 = getelementptr inbounds { i64, i64 }, ptr %f, i32 0, i32 1
|
|
store i64 %1, ptr %3, align 8
|
|
%4 = getelementptr inbounds { i64, i64 }, ptr %f, i32 0, i32 0
|
|
%lo = load i64, ptr %4, align 8
|
|
%5 = getelementptr inbounds { i64, i64 }, ptr %f, i32 0, i32 1
|
|
%hi = load i64, ptr %5, align 8
|
|
call void @hello2(i64 %lo, i64 %hi)
|
|
ret void
|
|
}
|
|
|