mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
37 lines
805 B
C
37 lines
805 B
C
// #target: macos-x64
|
|
|
|
module test;
|
|
|
|
enum Foo
|
|
{
|
|
ABC,
|
|
BCD
|
|
}
|
|
|
|
Foo zfok = Foo.values[0];
|
|
Foo[] zw = &&Foo.values;
|
|
|
|
fn void test(int x)
|
|
{
|
|
Foo zonk = Foo.values[x];
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
@test.zfok = local_unnamed_addr global i32 0, align 4
|
|
@.taddr = private global [2 x i32] [i32 0, i32 1], align 4
|
|
@test.zw = local_unnamed_addr global %"int[]" { ptr @.taddr, i64 2 }, align 8
|
|
|
|
; Function Attrs:
|
|
define void @test.test(i32 %0) #0 {
|
|
entry:
|
|
%zonk = alloca i32, align 4
|
|
%literal = alloca [2 x i32], align 4
|
|
call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 8, i1 false)
|
|
%sext = sext i32 %0 to i64
|
|
%ptroffset = getelementptr inbounds [4 x i8], ptr %literal, i64 %sext
|
|
%1 = load i32, ptr %ptroffset, align 4
|
|
store i32 %1, ptr %zonk, align 4
|
|
ret void
|
|
}
|