about summary refs log tree commit diff
path: root/tests/codegen-llvm/bigint-helpers.rs
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2025-08-08 21:59:28 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2025-08-08 21:59:28 -0700
commit8831c5b9946561a37dc7ee6fd826ef1470e8f380 (patch)
tree4a82d3c50e08fc3d028fa0e6d01259dcf0eebad1 /tests/codegen-llvm/bigint-helpers.rs
parent4c7749e8c8e50ad146da599eea3a250160c1bc2b (diff)
downloadrust-8831c5b9946561a37dc7ee6fd826ef1470e8f380.tar.gz
rust-8831c5b9946561a37dc7ee6fd826ef1470e8f380.zip
Stop using uadd.with.overflow
Diffstat (limited to 'tests/codegen-llvm/bigint-helpers.rs')
-rw-r--r--tests/codegen-llvm/bigint-helpers.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/codegen-llvm/bigint-helpers.rs b/tests/codegen-llvm/bigint-helpers.rs
index 355cccb8150..ec70a3eabed 100644
--- a/tests/codegen-llvm/bigint-helpers.rs
+++ b/tests/codegen-llvm/bigint-helpers.rs
@@ -3,11 +3,20 @@
 #![crate_type = "lib"]
 #![feature(bigint_helper_methods)]
 
+// Note that there's also an assembly test for this, which is what checks for
+// the `ADC` (Add with Carry) instruction on x86 now that the IR we emit uses
+// the preferred instruction phrasing instead of the intrinsic.
+
 // CHECK-LABEL: @u32_carrying_add
 #[no_mangle]
 pub fn u32_carrying_add(a: u32, b: u32, c: bool) -> (u32, bool) {
-    // CHECK: @llvm.uadd.with.overflow.i32
-    // CHECK: @llvm.uadd.with.overflow.i32
-    // CHECK: or disjoint i1
+    // CHECK: %[[AB:.+]] = add i32 {{%a, %b|%b, %a}}
+    // CHECK: %[[O1:.+]] = icmp ult i32 %[[AB]], %a
+    // CHECK: %[[CEXT:.+]] = zext i1 %c to i32
+    // CHECK: %[[ABC:.+]] = add i32 %[[AB]], %[[CEXT]]
+    // CHECK: %[[O2:.+]] = icmp ult i32 %[[ABC]], %[[AB]]
+    // CHECK: %[[O:.+]] = or disjoint i1 %[[O1]], %[[O2]]
+    // CHECK: insertvalue {{.+}}, i32 %[[ABC]], 0
+    // CHECK: insertvalue {{.+}}, i1 %[[O]], 1
     u32::carrying_add(a, b, c)
 }