[lld] [llvm] [RISCV] Support RISCV Atomics ABI attributes (PR #84597)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 2 09:03:04 PDT 2024


================
@@ -75,6 +75,13 @@ void RISCVTargetStreamer::emitTargetAttributes(const MCSubtargetInfo &STI,
     auto &ISAInfo = *ParseResult;
     emitTextAttribute(RISCVAttrs::ARCH, ISAInfo->toString());
   }
+
+  if (STI.hasFeature(RISCV::FeatureStdExtA)) {
+    unsigned AtomicABITag = STI.hasFeature(RISCV::FeatureTrailingSeqCstFence)
+                                ? RISCVAttrs::RISCVAtomicAbiTag::AtomicABI::A6S
----------------
asb wrote:

Is this the right way round? Isn't `STI.hasFeature(RISCV::FeatureTrailingSeqCstFence)` true if `+no-seq-cst-trailing-fence` is present? And if there's no trailing fence, then we have A6C? Or am I misreading?

I think it would be better to name the feature `FeatureNoTrailingSeqCstFence` as we do for `FeatureNoRVCHints`. Though I think this patch would be best if it aimed to change no defaults at all, and left that as a follow-on patch (which would hopefully be a quick LGTM as I think there's no objection to that, going by this review thread).

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


More information about the llvm-commits mailing list