about summary refs log tree commit diff
path: root/src/test/codegen/bool-cmp.rs
blob: 8769a4cb5e1898f078d07d031939342e3036a4e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This is a test for optimal Ord trait implementation for bool.
// See <https://github.com/rust-lang/rust/issues/66780> for more info.

// compile-flags: -C opt-level=3

#![crate_type = "lib"]

use std::cmp::Ordering;

// CHECK-LABEL: @cmp_bool
#[no_mangle]
pub fn cmp_bool(a: bool, b: bool) -> Ordering {
// CHECK: zext i1
// CHECK: zext i1
// CHECK: sub nsw
    a.cmp(&b)
}