We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 96983fc commit f5b16f6Copy full SHA for f5b16f6
src/test/codegen/integer-cmp.rs
@@ -0,0 +1,28 @@
1
+// 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
8
+use std::cmp::Ordering;
9
10
+// CHECK-LABEL: @cmp_signed
11
+#[no_mangle]
12
+pub fn cmp_signed(a: i64, b: i64) -> Ordering {
13
+// CHECK: icmp slt
14
+// CHECK: icmp sgt
15
+// CHECK: zext i1
16
+// CHECK: select i1
17
+ a.cmp(&b)
18
+}
19
20
+// CHECK-LABEL: @cmp_unsigned
21
22
+pub fn cmp_unsigned(a: u32, b: u32) -> Ordering {
23
+// CHECK: icmp ult
24
+// CHECK: icmp ugt
25
26
27
28
0 commit comments