about summary refs log tree commit diff
path: root/tests/codegen-llvm/issues/and-masked-comparison-131162.rs
blob: fc4b0341a31bcbd353ce948bae783e8a8b4a6139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//@ compile-flags: -Copt-level=3

#![crate_type = "lib"]

// CHECK-LABEL: @issue_131162
#[no_mangle]
pub fn issue_131162(a1: usize, a2: usize) -> bool {
    const MASK: usize = 1;

    // CHECK-NOT: xor
    // CHECK-NOT: trunc
    // CHECK-NOT: and i1
    // CHECK: icmp
    // CHECK-NEXT: ret
    (a1 & !MASK) == (a2 & !MASK) && (a1 & MASK) == (a2 & MASK)
}