1 // This is a test for optimal Ord trait implementation for bool. 2 // See <https://github.com/rust-lang/rust/issues/66780> for more info. 3 4 // compile-flags: -C opt-level=3 5 6 #![crate_type = "lib"] 7 8 use std::cmp::Ordering; 9 10 // CHECK-LABEL: @cmp_bool 11 #[no_mangle] cmp_bool(a: bool, b: bool) -> Ordering12pub fn cmp_bool(a: bool, b: bool) -> Ordering { 13 // LLVM 10 produces (zext a) + (sext b), but the final lowering is (zext a) - (zext b). 14 // CHECK: zext i1 15 // CHECK: {{z|s}}ext i1 16 // CHECK: {{sub|add}} nsw 17 a.cmp(&b) 18 } 19