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

Brendan Sweeney via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 23 16:37:46 PST 2024


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

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

>From 64c6259f1f6d92dc42034c0bb95add23e28d1f42 Mon Sep 17 00:00:00 2001
From: Brendan Sweeney <turtwig at utexas.edu>
Date: Mon, 23 Dec 2024 16:28:53 -0800
Subject: [PATCH] [RISCV] Emitting proper atomic ABI tag when Zalasr is enabled
 When Zalasr is enabled, it will emit the A7 atomic ABI tag.

---
 .../lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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);
   }
 }



More information about the llvm-commits mailing list