mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
40 lines
792 B
Plaintext
40 lines
792 B
Plaintext
// #target: macos-x64
|
|
module test;
|
|
import std::io;
|
|
|
|
enum Foo
|
|
{
|
|
ABC,
|
|
DEF
|
|
}
|
|
|
|
fn int hello(Foo a)
|
|
{
|
|
switch (a)
|
|
{
|
|
case ABC: return 1;
|
|
case DEF: return 0;
|
|
}
|
|
}
|
|
|
|
/* #expect: test.ll
|
|
|
|
define i32 @test.hello(i32 %0) #0 {
|
|
entry:
|
|
%switch = alloca i32, align 4
|
|
store i32 %0, ptr %switch, align 4
|
|
br label %switch.entry
|
|
switch.entry: ; preds = %entry
|
|
%1 = load i32, ptr %switch, align 4
|
|
switch i32 %1, label %switch.exit [
|
|
i32 0, label %switch.case
|
|
i32 1, label %switch.case1
|
|
]
|
|
switch.case: ; preds = %switch.entry
|
|
ret i32 1
|
|
switch.case1: ; preds = %switch.entry
|
|
ret i32 0
|
|
switch.exit: ; preds = %switch.entry
|
|
unreachable
|
|
}
|