]> git.lizzy.rs Git - rust.git/blob - tests/assembly/x86_64-no-jump-tables.rs
Rollup merge of #107735 - edward-shen:edward-shen/mailmap, r=dtolnay
[rust.git] / tests / assembly / x86_64-no-jump-tables.rs
1 // Test that jump tables are (not) emitted when the `-Zno-jump-tables`
2 // flag is (not) set.
3
4 // revisions: unset set
5 // assembly-output: emit-asm
6 // compile-flags: -O
7 // [set] compile-flags: -Zno-jump-tables
8 // only-x86_64
9
10 #![crate_type = "lib"]
11
12 extern "C" {
13     fn bar1();
14     fn bar2();
15     fn bar3();
16     fn bar4();
17     fn bar5();
18     fn bar6();
19 }
20
21 // CHECK-LABEL: foo:
22 #[no_mangle]
23 pub unsafe fn foo(x: i32) {
24     // unset: LJTI0_0
25     // set-NOT: LJTI0_0
26     match x {
27         1 => bar1(),
28         2 => bar2(),
29         3 => bar3(),
30         4 => bar4(),
31         5 => bar5(),
32         _ => bar6(),
33     }
34 }