about summary refs log tree commit diff
path: root/tests/codegen/array-cmp.rs
blob: 2565a385b61b5292af88996a12b70de312cfa5e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Ensure the asm for array comparisons is properly optimized.

//@ compile-flags: -C opt-level=2

#![crate_type = "lib"]

// CHECK-LABEL: @compare
// CHECK: start:
// CHECK-NEXT: ret i1 true
#[no_mangle]
pub fn compare() -> bool {
    let bytes = 12.5f32.to_ne_bytes();
    bytes
        == if cfg!(target_endian = "big") {
            [0x41, 0x48, 0x00, 0x00]
        } else {
            [0x00, 0x00, 0x48, 0x41]
        }
}