[llvm] [RISCV] Add additional fence for amocas when required by recent ABI change (PR #101023)

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 12:19:17 PDT 2024


================
@@ -212,6 +215,19 @@ bool RISCVCodeGenPrepare::expandVPStrideLoad(IntrinsicInst &II) {
   return true;
 }
 
+// Insert a leading fence (needed for broadest atomics ABI compatibility)
+// only if the Zacas extension is enabled and the AtomicCmpXchgInst has a
+// SequentiallyConsistent failure ordering.
+bool RISCVCodeGenPrepare::visitAtomicCmpXchgInst(AtomicCmpXchgInst &I) {
+  IRBuilder<> Builder(&I);
+  if (!ST->hasStdExtZacas() ||
----------------
jrtc27 wrote:

Can we ever reach here with an AtomicCmpXchgInst that won't be lowered to an AMOCAS, e.g. if it's oversized?

https://github.com/llvm/llvm-project/pull/101023


More information about the llvm-commits mailing list