[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-15 Thread Sander de Smalen via cfe-commits
https://github.com/sdesmalen-arm closed https://github.com/llvm/llvm-project/pull/76971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread via cfe-commits
https://github.com/rsandifo-arm approved this pull request. LGTM. There's one suggestion for a new test below, but please ignore if you think it's pointless. https://github.com/llvm/llvm-project/pull/76971 ___ cfe-commits mailing list

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread via cfe-commits
@@ -117,3 +117,10 @@ void f11(void) { struct __arm_inout("za") S4 *s; // expected-error {{'__arm_inout' cannot appear here}} struct S5 {}; int c = sizeof(struct __arm_inout("za") S5); // expected-error {{'__arm_inout' cannot appear here}} + +void invalid_parentheses1()

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread via cfe-commits
https://github.com/rsandifo-arm edited https://github.com/llvm/llvm-project/pull/76971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread Sander de Smalen via cfe-commits
@@ -30,7 +30,7 @@ // CPP-CHECK-NEXT:tail call void @llvm.aarch64.sme.write.ver.vg2.nxv16i8(i32 0, i32 [[BASE:%.*]], [[TMP0]], [[TMP1]]) // CPP-CHECK-NEXT:ret void // -void test_svwrite_ver_za8_u8_vg2(uint32_t base, svuint8x2_t val) __arm_streaming __arm_shared_za {

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread Sander de Smalen via cfe-commits
@@ -66,7 +66,7 @@ void test_svzero_mask_za_2(void) __arm_shared_za { // CHECK-CXX-NEXT:tail call void @llvm.aarch64.sme.zero(i32 255) // CHECK-CXX-NEXT:ret void // -void test_svzero_za(void) __arm_shared_za { +void test_svzero_za(void) __arm_inout("za") {

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread Sander de Smalen via cfe-commits
@@ -1,60 +1,60 @@ // RUN: %clang_cc1 -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sme -verify=expected,notc2x -Wno-strict-prototypes %s // RUN: %clang_cc1 -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sme -verify=expected,c2x %s -enum

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread Sander de Smalen via cfe-commits
@@ -6898,13 +6941,18 @@ at the end of the function. }]; } -def ArmSmeNewZADocs : Documentation { +def ArmNewDocs : Documentation { let Category = DocCatArmSmeAttributes; let Content = [{ -The ``__arm_new_za`` keyword applies to function declarations and specifies

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread Sander de Smalen via cfe-commits
@@ -8806,26 +8806,90 @@ static bool MustDelayAttributeArguments(const ParsedAttr ) { return false; } +static bool checkArmNewAttrMutualExclusion(Sema , const ParsedAttr , + const FunctionProtoType *FPT, +

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-12 Thread Sander de Smalen via cfe-commits
@@ -255,6 +255,22 @@ class AttributeCommonInfo { return SpellingIndex != SpellingNotCalculated; } }; + +enum class KeywordAttributeParseArgumentsKind { None, Optional, Required }; sdesmalen-arm wrote: Done.

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-11 Thread via cfe-commits
@@ -1,60 +1,60 @@ // RUN: %clang_cc1 -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sme -verify=expected,notc2x -Wno-strict-prototypes %s // RUN: %clang_cc1 -fsyntax-only -triple aarch64-none-linux-gnu -target-feature +sme -verify=expected,c2x %s -enum

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-11 Thread via cfe-commits
@@ -8806,26 +8806,90 @@ static bool MustDelayAttributeArguments(const ParsedAttr ) { return false; } +static bool checkArmNewAttrMutualExclusion(Sema , const ParsedAttr , + const FunctionProtoType *FPT, +

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-11 Thread via cfe-commits
@@ -66,7 +66,7 @@ void test_svzero_mask_za_2(void) __arm_shared_za { // CHECK-CXX-NEXT:tail call void @llvm.aarch64.sme.zero(i32 255) // CHECK-CXX-NEXT:ret void // -void test_svzero_za(void) __arm_shared_za { +void test_svzero_za(void) __arm_inout("za") {

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-11 Thread via cfe-commits
@@ -6898,13 +6941,18 @@ at the end of the function. }]; } -def ArmSmeNewZADocs : Documentation { +def ArmNewDocs : Documentation { let Category = DocCatArmSmeAttributes; let Content = [{ -The ``__arm_new_za`` keyword applies to function declarations and specifies

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-11 Thread via cfe-commits
@@ -255,6 +255,22 @@ class AttributeCommonInfo { return SpellingIndex != SpellingNotCalculated; } }; + +enum class KeywordAttributeParseArgumentsKind { None, Optional, Required }; rsandifo-arm wrote: I think this must fundamentally be a boolean

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-11 Thread via cfe-commits
@@ -30,7 +30,7 @@ // CPP-CHECK-NEXT:tail call void @llvm.aarch64.sme.write.ver.vg2.nxv16i8(i32 0, i32 [[BASE:%.*]], [[TMP0]], [[TMP1]]) // CPP-CHECK-NEXT:ret void // -void test_svwrite_ver_za8_u8_vg2(uint32_t base, svuint8x2_t val) __arm_streaming __arm_shared_za {

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-11 Thread via cfe-commits
https://github.com/rsandifo-arm edited https://github.com/llvm/llvm-project/pull/76971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-11 Thread via cfe-commits
https://github.com/rsandifo-arm commented: Thanks for the update, looks great to me. The only substantive comment I have is that I think a given keyword attribute must always take `(` and `)` or never take them. It shouldn't be optional, because that risks creating parsing ambiguities, or

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-05 Thread Sander de Smalen via cfe-commits
@@ -1767,14 +1767,22 @@ static void AddAttributesFromFunctionProtoType(ASTContext , FPT->isNothrow()) FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); - if (FPT->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask) + unsigned SMEBits =

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-05 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 9803de0e8e3abbbc94a4265d5847db435897a384 e49a2dd0ef817eed3b6246a553efd7423b861130 --

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-05 Thread Sander de Smalen via cfe-commits
@@ -3175,11 +3175,16 @@ static void checkArmStreamingBuiltin(Sema , CallExpr *TheCall, } static bool hasSMEZAState(const FunctionDecl *FD) { - if (FD->hasAttr()) -return true; - if (const auto *T = FD->getType()->getAs()) -if (T->getAArch64SMEAttributes() &

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-05 Thread Sander de Smalen via cfe-commits
@@ -6787,6 +6787,9 @@ void Parser::ParseDirectDeclarator(Declarator ) { // For consistency with attribute parsing. Diag(Tok, diag::err_keyword_not_allowed) << Tok.getIdentifierInfo(); ConsumeToken(); + BalancedDelimiterTracker T(*this, tok::l_paren);

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
@@ -1767,14 +1767,22 @@ static void AddAttributesFromFunctionProtoType(ASTContext , FPT->isNothrow()) FuncAttrs.addAttribute(llvm::Attribute::NoUnwind); - if (FPT->getAArch64SMEAttributes() & FunctionType::SME_PStateSMEnabledMask) + unsigned SMEBits =

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
@@ -3175,11 +3175,16 @@ static void checkArmStreamingBuiltin(Sema , CallExpr *TheCall, } static bool hasSMEZAState(const FunctionDecl *FD) { - if (FD->hasAttr()) -return true; - if (const auto *T = FD->getType()->getAs()) -if (T->getAArch64SMEAttributes() &

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
@@ -4033,12 +4033,27 @@ class FunctionType : public Type { SME_NormalFunction = 0, SME_PStateSMEnabledMask = 1 << 0, SME_PStateSMCompatibleMask = 1 << 1, -SME_PStateZASharedMask = 1 << 2, -SME_PStateZAPreservedMask = 1 << 3, -SME_AttributeMask =

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
@@ -6787,6 +6787,9 @@ void Parser::ParseDirectDeclarator(Declarator ) { // For consistency with attribute parsing. Diag(Tok, diag::err_keyword_not_allowed) << Tok.getIdentifierInfo(); ConsumeToken(); + BalancedDelimiterTracker T(*this, tok::l_paren);

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
@@ -6852,30 +6852,73 @@ without changing modes. }]; } -def ArmSmeSharedZADocs : Documentation { +def ArmInDocs : Documentation { let Category = DocCatArmSmeAttributes; let Content = [{ -The ``__arm_shared_za`` keyword applies to prototyped function types and

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
@@ -3696,6 +3696,12 @@ def err_sme_definition_using_sm_in_non_sme_target : Error< "function executed in streaming-SVE mode requires 'sme'">; def err_sme_definition_using_za_in_non_sme_target : Error< "function using ZA state requires 'sme'">; +def

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
https://github.com/rsandifo-arm commented: Thanks for doing this, looks good! I've got some initial comments below, but I think they probably repeat for other parts of the patch. The two main ones are: * We should consume arguments to attribute keywords iff the attribute is defined to take

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
https://github.com/rsandifo-arm edited https://github.com/llvm/llvm-project/pull/76971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread Sander de Smalen via cfe-commits
sdesmalen-arm wrote: I'm aware the PR is quite large, but I didn't really know a sensible way to split this up. I'm happy to split things out if there are any suggestions. https://github.com/llvm/llvm-project/pull/76971 ___ cfe-commits mailing list

[clang] [Clang][AArch64] Change SME attributes for shared/new/preserved state. (PR #76971)

2024-01-04 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-codegen Author: Sander de Smalen (sdesmalen-arm) Changes This patch replaces the `__arm_new_za`, `__arm_shared_za` and `__arm_preserves_za` attributes in favour of: * `__arm_new("za")` * `__arm_in("za")` * `__arm_out("za")` * `__arm_inout("za")`