]> git.proxmox.com Git - rustc.git/blob - tests/codegen/match-unoptimized.rs
New upstream version 1.69.0+dfsg1
[rustc.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 }