about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-30 07:42:19 +0000
committerbors <bors@rust-lang.org>2023-12-30 07:42:19 +0000
commitddca5343f2988f49fa407dc1ff43bcf779ea4173 (patch)
tree2a132f580177b57a206e23599d6a4c5d5bb9d83e /compiler/rustc_codegen_ssa
parentfe2cfd45055abfde24cb372a311095c105265236 (diff)
parent6cf61394119f2452557d5b30f52f9a2474074857 (diff)
downloadrust-ddca5343f2988f49fa407dc1ff43bcf779ea4173.tar.gz
rust-ddca5343f2988f49fa407dc1ff43bcf779ea4173.zip
Auto merge of #118705 - WaffleLapkin:codegen-atomic-exhange-untuple, r=cjgillot
Change `rustc_codegen_ssa`'s `atomic_cmpxchg` interface to return a pair of values

Doesn't change much, but a little nicer that way.
Diffstat (limited to 'compiler/rustc_codegen_ssa')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/intrinsic.rs4
-rw-r--r--compiler/rustc_codegen_ssa/src/traits/builder.rs2
2 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
index 533803ea7ff..8530bf9e2b3 100644
--- a/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/intrinsic.rs
@@ -335,7 +335,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                                 cmp = bx.ptrtoint(cmp, bx.type_isize());
                                 src = bx.ptrtoint(src, bx.type_isize());
                             }
-                            let pair = bx.atomic_cmpxchg(
+                            let (val, success) = bx.atomic_cmpxchg(
                                 dst,
                                 cmp,
                                 src,
@@ -343,8 +343,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
                                 parse_ordering(bx, failure),
                                 weak,
                             );
-                            let val = bx.extract_value(pair, 0);
-                            let success = bx.extract_value(pair, 1);
                             let val = bx.from_immediate(val);
                             let success = bx.from_immediate(success);
 
diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs
index aa411f002a0..1c5c78e6ca2 100644
--- a/compiler/rustc_codegen_ssa/src/traits/builder.rs
+++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs
@@ -296,7 +296,7 @@ pub trait BuilderMethods<'a, 'tcx>:
         order: AtomicOrdering,
         failure_order: AtomicOrdering,
         weak: bool,
-    ) -> Self::Value;
+    ) -> (Self::Value, Self::Value);
     fn atomic_rmw(
         &mut self,
         op: AtomicRmwBinOp,