[llvm] [RISCV] Emitting proper atomic ABI tag when Zalasr is enabled (PR #121017)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 16:38:25 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Brendan Sweeney (mehnadnerd)

<details>
<summary>Changes</summary>

When Zalasr is enabled, it will emit the A7 atomic ABI tag.

---
Full diff: https://github.com/llvm/llvm-project/pull/121017.diff


1 Files Affected:

- (modified) llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp (+5-3) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
index 99f57f47835abd..6035dffaa8ac8e 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
@@ -86,9 +86,11 @@ void RISCVTargetStreamer::emitTargetAttributes(const MCSubtargetInfo &STI,
 
   if (RiscvAbiAttr && STI.hasFeature(RISCV::FeatureStdExtA)) {
     unsigned AtomicABITag = static_cast<unsigned>(
-        STI.hasFeature(RISCV::FeatureNoTrailingSeqCstFence)
-            ? RISCVAttrs::RISCVAtomicAbiTag::A6C
-            : RISCVAttrs::RISCVAtomicAbiTag::A6S);
+        STI.hasFeature(RISCV::FeatureStdExtZalasr)
+            ? RISCVAttrs::RISCVAtomicAbiTag::A7
+            : STI.hasFeature(RISCV::FeatureNoTrailingSeqCstFence)
+              ? RISCVAttrs::RISCVAtomicAbiTag::A6C
+              : RISCVAttrs::RISCVAtomicAbiTag::A6S);
     emitAttribute(RISCVAttrs::ATOMIC_ABI, AtomicABITag);
   }
 }

``````````

</details>


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


More information about the llvm-commits mailing list