Skip to content

Commit b38b7d5

Browse files
committed
fixup: rebase and check for new za state
1 parent c49ff5e commit b38b7d5

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ def err_function_needs_feature : Error<
281281
"be inlined into function %0 that is compiled without support for '%2'">;
282282
def err_function_always_inline_attribute_mismatch : Error<
283283
"always_inline function %1 and its caller %0 have mismatched %2 attributes">;
284+
def err_function_always_inline_new_za : Error<
285+
"always_inline function %0 has new za state">;
284286

285287
def warn_avx_calling_convention
286288
: Warning<"AVX vector %select{return|argument}0 of type %1 without '%2' "

clang/lib/CodeGen/Targets/AArch64.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,10 @@ void AArch64TargetCodeGenInfo::checkFunctionCallABI(
831831
llvm::SMEAttrs FAttrs;
832832
if (F->hasAttr<ArmLocallyStreamingAttr>())
833833
FAttrs.set(llvm::SMEAttrs::Mask::SM_Enabled);
834+
if (auto *NewAttr = F->getAttr<ArmNewAttr>()) {
835+
if (NewAttr->isNewZA())
836+
FAttrs.set(llvm::SMEAttrs::Mask::ZA_New);
837+
}
834838
if (const auto *T = F->getType()->getAs<FunctionProtoType>()) {
835839
if (T->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask)
836840
FAttrs.set(llvm::SMEAttrs::Mask::SM_Enabled);
@@ -848,6 +852,9 @@ void AArch64TargetCodeGenInfo::checkFunctionCallABI(
848852
CGM.getDiags().Report(CallLoc,
849853
diag::err_function_always_inline_attribute_mismatch)
850854
<< Caller->getDeclName() << Callee->getDeclName() << "streaming";
855+
if (CalleeAttrs.hasNewZABody())
856+
CGM.getDiags().Report(CallLoc, diag::err_function_always_inline_new_za)
857+
<< Callee->getDeclName();
851858
}
852859

853860
std::unique_ptr<TargetCodeGenInfo>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %clang --target=aarch64-none-linux-gnu -march=armv9-a+sme -O3 -S -Xclang -verify %s
2+
3+
__attribute__((always_inline)) __arm_new("za")
4+
void inline_new_za(void) { }
5+
// expected-error@+1 {{always_inline function 'inline_new_za' has new za state}}
6+
void inline_caller() { inline_new_za(); }

0 commit comments

Comments
 (0)