blob: 8ada3cf09d0739e00a4085063b3be11e709d3749 [file] [log] [blame]
Lzu Taof5b16f62019-08-21 15:50:431// This is test for more optimal Ord implementation for integers.
2// See <https://github.com/rust-lang/rust/issues/63758> for more info.
3
4// compile-flags: -C opt-level=3
5
6#![crate_type = "lib"]
7
8use std::cmp::Ordering;
9
10// CHECK-LABEL: @cmp_signed
11#[no_mangle]
12pub fn cmp_signed(a: i64, b: i64) -> Ordering {
13// CHECK: icmp slt
Lzu Taoade191c2019-08-29 03:52:1814// CHECK: icmp ne
Lzu Taof5b16f62019-08-21 15:50:4315// CHECK: zext i1
16// CHECK: select i1
17 a.cmp(&b)
18}
19
20// CHECK-LABEL: @cmp_unsigned
21#[no_mangle]
22pub fn cmp_unsigned(a: u32, b: u32) -> Ordering {
23// CHECK: icmp ult
Lzu Taoade191c2019-08-29 03:52:1824// CHECK: icmp ne
Lzu Taof5b16f62019-08-21 15:50:4325// CHECK: zext i1
26// CHECK: select i1
27 a.cmp(&b)
28}