about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2023-02-16 23:59:13 -0800
committerScott McMurray <scottmcm@users.noreply.github.com>2023-02-16 23:59:13 -0800
commit680e21687d5540a425f11d468edcda0ce39c6289 (patch)
tree835fb93e8a06c2a3a9a3045efdf32dfebff8c0c8 /tests/codegen
parentdc37e373292d00572ff884a1a095cc4574d9fe82 (diff)
downloadrust-680e21687d5540a425f11d468edcda0ce39c6289.tar.gz
rust-680e21687d5540a425f11d468edcda0ce39c6289.zip
Use `partial_cmp` to implement tuple `lt`/`le`/`ge`/`gt`
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/comparison-operators-2-tuple.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/codegen/comparison-operators-2-tuple.rs b/tests/codegen/comparison-operators-2-tuple.rs
index 0244162e9bf..a9d25e3b53c 100644
--- a/tests/codegen/comparison-operators-2-tuple.rs
+++ b/tests/codegen/comparison-operators-2-tuple.rs
@@ -11,6 +11,9 @@ type TwoTuple = (i16, u16);
 //
 // The operators are all overridden directly, so should optimize easily.
 //
+// Yes, the `s[lg]t` is correct for the `[lg]e` version because it's only used
+// in the side of the select where we know the values are *not* equal.
+//
 
 // CHECK-LABEL: @check_lt_direct
 // CHECK-SAME: (i16 noundef %[[A0:.+]], i16 noundef %[[A1:.+]], i16 noundef %[[B0:.+]], i16 noundef %[[B1:.+]])
@@ -29,7 +32,7 @@ pub fn check_lt_direct(a: TwoTuple, b: TwoTuple) -> bool {
 #[no_mangle]
 pub fn check_le_direct(a: TwoTuple, b: TwoTuple) -> bool {
     // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]]
-    // CHECK-DAG: %[[CMP0:.+]] = icmp sle i16 %[[A0]], %[[B0]]
+    // CHECK-DAG: %[[CMP0:.+]] = icmp slt i16 %[[A0]], %[[B0]]
     // CHECK-DAG: %[[CMP1:.+]] = icmp ule i16 %[[A1]], %[[B1]]
     // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]]
     // CHECK: ret i1 %[[R]]
@@ -53,7 +56,7 @@ pub fn check_gt_direct(a: TwoTuple, b: TwoTuple) -> bool {
 #[no_mangle]
 pub fn check_ge_direct(a: TwoTuple, b: TwoTuple) -> bool {
     // CHECK-DAG: %[[EQ:.+]] = icmp eq i16 %[[A0]], %[[B0]]
-    // CHECK-DAG: %[[CMP0:.+]] = icmp sge i16 %[[A0]], %[[B0]]
+    // CHECK-DAG: %[[CMP0:.+]] = icmp sgt i16 %[[A0]], %[[B0]]
     // CHECK-DAG: %[[CMP1:.+]] = icmp uge i16 %[[A1]], %[[B1]]
     // CHECK: %[[R:.+]] = select i1 %[[EQ]], i1 %[[CMP1]], i1 %[[CMP0]]
     // CHECK: ret i1 %[[R]]