about summary refs log tree commit diff
path: root/tests/codegen/intrinsics/three_way_compare.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen/intrinsics/three_way_compare.rs')
-rw-r--r--tests/codegen/intrinsics/three_way_compare.rs27
1 files changed, 5 insertions, 22 deletions
diff --git a/tests/codegen/intrinsics/three_way_compare.rs b/tests/codegen/intrinsics/three_way_compare.rs
index 9a476abe891..95fcb636f7c 100644
--- a/tests/codegen/intrinsics/three_way_compare.rs
+++ b/tests/codegen/intrinsics/three_way_compare.rs
@@ -2,6 +2,7 @@
 //@ [DEBUG] compile-flags: -C opt-level=0
 //@ [OPTIM] compile-flags: -C opt-level=3
 //@ compile-flags: -C no-prepopulate-passes
+//@ min-llvm-version: 20
 
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
@@ -12,17 +13,8 @@ use std::intrinsics::three_way_compare;
 // CHECK-LABEL: @signed_cmp
 // CHECK-SAME: (i16{{.*}} %a, i16{{.*}} %b)
 pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering {
-    // DEBUG: %[[GT:.+]] = icmp sgt i16 %a, %b
-    // DEBUG: %[[ZGT:.+]] = zext i1 %[[GT]] to i8
-    // DEBUG: %[[LT:.+]] = icmp slt i16 %a, %b
-    // DEBUG: %[[ZLT:.+]] = zext i1 %[[LT]] to i8
-    // DEBUG: %[[R:.+]] = sub nsw i8 %[[ZGT]], %[[ZLT]]
-
-    // OPTIM: %[[LT:.+]] = icmp slt i16 %a, %b
-    // OPTIM: %[[NE:.+]] = icmp ne i16 %a, %b
-    // OPTIM: %[[CGE:.+]] = select i1 %[[NE]], i8 1, i8 0
-    // OPTIM: %[[CGEL:.+]] = select i1 %[[LT]], i8 -1, i8 %[[CGE]]
-    // OPTIM: ret i8 %[[CGEL]]
+    // CHECK: %[[CMP:.+]] = call i8 @llvm.scmp.i8.i16(i16 %a, i16 %b)
+    // CHECK-NEXT: ret i8 %[[CMP]]
     three_way_compare(a, b)
 }
 
@@ -30,16 +22,7 @@ pub fn signed_cmp(a: i16, b: i16) -> std::cmp::Ordering {
 // CHECK-LABEL: @unsigned_cmp
 // CHECK-SAME: (i16{{.*}} %a, i16{{.*}} %b)
 pub fn unsigned_cmp(a: u16, b: u16) -> std::cmp::Ordering {
-    // DEBUG: %[[GT:.+]] = icmp ugt i16 %a, %b
-    // DEBUG: %[[ZGT:.+]] = zext i1 %[[GT]] to i8
-    // DEBUG: %[[LT:.+]] = icmp ult i16 %a, %b
-    // DEBUG: %[[ZLT:.+]] = zext i1 %[[LT]] to i8
-    // DEBUG: %[[R:.+]] = sub nsw i8 %[[ZGT]], %[[ZLT]]
-
-    // OPTIM: %[[LT:.+]] = icmp ult i16 %a, %b
-    // OPTIM: %[[NE:.+]] = icmp ne i16 %a, %b
-    // OPTIM: %[[CGE:.+]] = select i1 %[[NE]], i8 1, i8 0
-    // OPTIM: %[[CGEL:.+]] = select i1 %[[LT]], i8 -1, i8 %[[CGE]]
-    // OPTIM: ret i8 %[[CGEL]]
+    // CHECK: %[[CMP:.+]] = call i8 @llvm.ucmp.i8.i16(i16 %a, i16 %b)
+    // CHECK-NEXT: ret i8 %[[CMP]]
     three_way_compare(a, b)
 }