parent
ceb0441e82
commit
d6c73ebbf3
1 changed files with 15 additions and 0 deletions
15
tests/codegen/const-array.rs
Normal file
15
tests/codegen/const-array.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
//@ compile-flags: -O
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
const LUT: [u8; 2] = [1, 1];
|
||||||
|
|
||||||
|
// CHECK-LABEL: @decode
|
||||||
|
#[no_mangle]
|
||||||
|
pub fn decode(i: u8) -> u8 {
|
||||||
|
// CHECK: start:
|
||||||
|
// CHECK-NEXT: icmp
|
||||||
|
// CHECK-NEXT: select
|
||||||
|
// CHECK-NEXT: ret
|
||||||
|
if i < 2 { LUT[i as usize] } else { 2 }
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue