diff options
author | Paul Kirth <paulkirth@google.com> | 2024-05-09 17:21:28 -0700 |
---|---|---|
committer | Paul Kirth <paulkirth@google.com> | 2024-05-09 17:21:28 -0700 |
commit | 0f0a91827e4538fdc633c22ed046a3dce98a2697 (patch) | |
tree | dc8c7b76cdbaa16ac2078c6d196f29e53fc988e0 | |
parent | 907f6f01b4ff8831cb852d747acd11d480d5757e (diff) |
Add flag for attributes emmissionupstream/users/ilovepi/spr/reapply-riscv-support-riscv-atomics-abi-attributes-84597
Created using spr 1.3.4
-rw-r--r-- | llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/RISCV/RISCVFeatures.td | 3 | ||||
-rw-r--r-- | llvm/test/CodeGen/RISCV/attributes.ll | 4 |
3 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp index 6f5f12cc7286..45ca0f4b57dd 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp @@ -76,7 +76,8 @@ void RISCVTargetStreamer::emitTargetAttributes(const MCSubtargetInfo &STI, emitTextAttribute(RISCVAttrs::ARCH, ISAInfo->toString()); } - if (STI.hasFeature(RISCV::FeatureStdExtA)) { + if (STI.hasFeature(RISCV::FeatureAbiAttributes) && + STI.hasFeature(RISCV::FeatureStdExtA)) { unsigned AtomicABITag = STI.hasFeature(RISCV::FeatureTrailingSeqCstFence) ? RISCVAttrs::RISCVAtomicAbiTag::AtomicABI::A6S : RISCVAttrs::RISCVAtomicAbiTag::AtomicABI::A6C; diff --git a/llvm/lib/Target/RISCV/RISCVFeatures.td b/llvm/lib/Target/RISCV/RISCVFeatures.td index c3dc4ea53697..c1d0d01082d0 100644 --- a/llvm/lib/Target/RISCV/RISCVFeatures.td +++ b/llvm/lib/Target/RISCV/RISCVFeatures.td @@ -1221,6 +1221,9 @@ def FeatureTrailingSeqCstFence : SubtargetFeature<"seq-cst-trailing-fence", "true", "Enable trailing fence for seq-cst store.">; +def FeatureAbiAttributes : SubtargetFeature<"abi-attr", "EnableAbiAttributes", + "true", "Enable emitting RISC-V ABI attributes">; + def FeatureUnalignedScalarMem : SubtargetFeature<"unaligned-scalar-mem", "EnableUnalignedScalarMem", "true", "Has reasonably performant unaligned scalar " diff --git a/llvm/test/CodeGen/RISCV/attributes.ll b/llvm/test/CodeGen/RISCV/attributes.ll index 1aff3e8b83f4..272659d8d2eb 100644 --- a/llvm/test/CodeGen/RISCV/attributes.ll +++ b/llvm/test/CodeGen/RISCV/attributes.ll @@ -129,8 +129,8 @@ ; RUN: llc -mtriple=riscv64 -mattr=+m %s -o - | FileCheck --check-prefixes=CHECK,RV64M %s ; RUN: llc -mtriple=riscv64 -mattr=+zmmul %s -o - | FileCheck --check-prefixes=CHECK,RV64ZMMUL %s ; RUN: llc -mtriple=riscv64 -mattr=+m,+zmmul %s -o - | FileCheck --check-prefixes=CHECK,RV64MZMMUL %s -; RUN: llc -mtriple=riscv64 -mattr=+a %s -o - | FileCheck --check-prefixes=CHECK,RV64A,A6C %s -; RUN: llc -mtriple=riscv64 -mattr=+a,+seq-cst-trailing-fence %s -o - | FileCheck --check-prefixes=CHECK,RV64A,A6S %s +; RUN: llc -mtriple=riscv64 -mattr=+a,+abi-attr %s -o - | FileCheck --check-prefixes=CHECK,RV64A,A6C %s +; RUN: llc -mtriple=riscv64 -mattr=+a,+seq-cst-trailing-fence,+abi-attr %s -o - | FileCheck --check-prefixes=CHECK,RV64A,A6S %s ; RUN: llc -mtriple=riscv64 -mattr=+f %s -o - | FileCheck --check-prefixes=CHECK,RV64F %s ; RUN: llc -mtriple=riscv64 -mattr=+d %s -o - | FileCheck --check-prefixes=CHECK,RV64D %s ; RUN: llc -mtriple=riscv64 -mattr=+c %s -o - | FileCheck --check-prefixes=CHECK,RV64C %s |