Files
c3c/test/test_suite/statements/exhaustive_switch.c3t
2023-07-09 01:18:01 +02:00

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
}