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

Sam Elliott via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 08:09:02 PST 2025


================
@@ -86,7 +86,9 @@ void RISCVTargetStreamer::emitTargetAttributes(const MCSubtargetInfo &STI,
 
   if (RiscvAbiAttr && STI.hasFeature(RISCV::FeatureStdExtA)) {
     unsigned AtomicABITag = static_cast<unsigned>(
-        STI.hasFeature(RISCV::FeatureNoTrailingSeqCstFence)
+        STI.hasFeature(RISCV::FeatureStdExtZalasr)
+            ? RISCVAttrs::RISCVAtomicAbiTag::A7
+        : STI.hasFeature(RISCV::FeatureNoTrailingSeqCstFence)
             ? RISCVAttrs::RISCVAtomicAbiTag::A6C
             : RISCVAttrs::RISCVAtomicAbiTag::A6S);
----------------
lenary wrote:

Can you refactor this to avoid nesting ternary expressions?

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


More information about the llvm-commits mailing list