File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -192,8 +192,11 @@ void RISCVTargetInfo::getTargetDefines(const LangOptions &Opts,
192192 Builder.defineMacro (" __riscv_muldiv" );
193193 }
194194
195- if (ISAInfo->hasExtension (" a" )) {
195+ // The "a" extension is composed of "zalrsc" and "zaamo"
196+ if (ISAInfo->hasExtension (" zalrsc" ) && ISAInfo->hasExtension (" zaamo" ))
196197 Builder.defineMacro (" __riscv_atomic" );
198+
199+ if (ISAInfo->hasExtension (" zalrsc" )) {
197200 Builder.defineMacro (" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1" );
198201 Builder.defineMacro (" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2" );
199202 Builder.defineMacro (" __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4" );
Original file line number Diff line number Diff line change @@ -195,7 +195,8 @@ class LLVM_LIBRARY_VISIBILITY RISCV32TargetInfo : public RISCVTargetInfo {
195195 void setMaxAtomicWidth () override {
196196 MaxAtomicPromoteWidth = 128 ;
197197
198- if (ISAInfo->hasExtension (" a" ))
198+ // "a" implies "zalrsc" which is sufficient to inline atomics
199+ if (ISAInfo->hasExtension (" zalrsc" ))
199200 MaxAtomicInlineWidth = 32 ;
200201 }
201202};
@@ -225,7 +226,8 @@ class LLVM_LIBRARY_VISIBILITY RISCV64TargetInfo : public RISCVTargetInfo {
225226 void setMaxAtomicWidth () override {
226227 MaxAtomicPromoteWidth = 128 ;
227228
228- if (ISAInfo->hasExtension (" a" ))
229+ // "a" implies "zalrsc" which is sufficient to inline atomics
230+ if (ISAInfo->hasExtension (" zalrsc" ))
229231 MaxAtomicInlineWidth = 64 ;
230232 }
231233};
You can’t perform that action at this time.
0 commit comments