]> git.lizzy.rs Git - rust.git/blob - tests/codegen/match-unoptimized.rs
Rollup merge of #106106 - jyn514:remote-tracking-branch, r=Mark-Simulacrum
[rust.git] / tests / codegen / match-unoptimized.rs
1 // compile-flags: -C no-prepopulate-passes -Copt-level=0
2
3 #![crate_type = "lib"]
4
5 #[repr(u16)]
6 pub enum E2 {
7     A = 13,
8     B = 42,
9 }
10
11 // For unoptimized code we produce a `br` instead of a `switch`. Compare with
12 // `tests/codegen/match-optimized.rs`
13
14 // CHECK-LABEL: @exhaustive_match_2
15 #[no_mangle]
16 pub fn exhaustive_match_2(e: E2) -> u8 {
17     // CHECK: %[[CMP:.+]] = icmp eq i16 %{{.+}}, 13
18     // CHECK-NEXT: br i1 %[[CMP:.+]],
19     match e {
20         E2::A => 0,
21         E2::B => 1,
22     }
23 }