Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RISCV] Emitting proper atomic ABI tag when Zalasr is enabled #121017

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mehnadnerd
Copy link
Contributor

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

@llvmbot
Copy link
Member

llvmbot commented Dec 24, 2024

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

Author: Brendan Sweeney (mehnadnerd)

Changes

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

Copy link

github-actions bot commented Dec 24, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@mehnadnerd
Copy link
Contributor Author

Still upgrading tests

@mehnadnerd mehnadnerd force-pushed the dev/brs/zalasrlower branch 2 times, most recently from 2077859 to a96abb9 Compare December 24, 2024 22:36
When Zalasr is enabled, it will emit the A7 atomic ABI tag.
@mehnadnerd mehnadnerd force-pushed the dev/brs/zalasrlower branch from a96abb9 to ff3ea14 Compare January 4, 2025 23:21
@mehnadnerd mehnadnerd requested a review from lenary January 4, 2025 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants