mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 09:16:05 +00:00

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")` * `__arm_preserves("za")` As described in https://github.com/ARM-software/acle/pull/276. One change is that `__arm_in/out/inout/preserves(S)` are all mutually exclusive, whereas previously it was fine to write `__arm_shared_za __arm_preserves_za`. This case is now represented with `__arm_in("za")`. The current implementation uses the same LLVM attributes under the hood, since `__arm_in/out/inout` are all variations of "shared ZA", so can use the existing `aarch64_pstate_za_shared` attribute in LLVM. #77941 will add support for the new "zt0" state as introduced with SME2.
67 lines
3.9 KiB
C++
67 lines
3.9 KiB
C++
// Test without serialization:
|
|
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -std=c++2a -ast-dump -ast-dump-filter Foo %s | FileCheck -strict-whitespace %s
|
|
|
|
// Test with serialization:
|
|
// RUN: %clang_cc1 -std=c++20 -triple aarch64 -target-feature +sme -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -x c++ -std=c++20 -triple aarch64 -target-feature +sme -include-pch %t -ast-dump-all -ast-dump-filter Foo /dev/null \
|
|
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
|
|
// RUN: | FileCheck --strict-whitespace %s
|
|
|
|
struct Foo {
|
|
// CHECK: |-CXXRecordDecl {{.*}} implicit struct Foo
|
|
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_streaming 'void () __arm_streaming'
|
|
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_streaming_compatible 'void () __arm_streaming_compatible'
|
|
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_locally_streaming 'void ()'
|
|
// CHECK-NEXT: | `-ArmLocallyStreamingAttr
|
|
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_shared_za 'void () __arm_inout("za")'
|
|
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_new_za 'void ()'
|
|
// CHECK-NEXT: | `-ArmNewAttr {{.*}} za
|
|
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_preserves_za 'void () __arm_preserves("za")'
|
|
void f_streaming() __arm_streaming;
|
|
void f_streaming_compatible() __arm_streaming_compatible;
|
|
__arm_locally_streaming void f_locally_streaming();
|
|
void f_shared_za() __arm_inout("za");
|
|
__arm_new("za") void f_new_za();
|
|
void f_preserves_za() __arm_preserves("za");
|
|
|
|
|
|
// CHECK: |-CXXMethodDecl {{.*}} test_lambda 'int (int)' implicit-inline
|
|
// CHECK: `-CompoundStmt
|
|
// CHECK-NEXT: |-DeclStmt
|
|
// CHECK-NEXT: | `-VarDecl
|
|
// CHECK-NEXT: | `-LambdaExpr
|
|
// CHECK-NEXT: | |-CXXRecordDecl
|
|
// CHECK: | | |-CXXMethodDecl {{.*}} used constexpr operator() 'int (int) __arm_streaming const' inline
|
|
// CHECK: | | |-CXXConversionDecl {{.*}} implicit constexpr operator int (*)(int) __arm_streaming 'int (*() const noexcept)(int) __arm_streaming' inline
|
|
// CHECK: | | |-CXXMethodDecl {{.*}} implicit __invoke 'int (int) __arm_streaming' static inline
|
|
// CHECK: `-ReturnStmt
|
|
// CHECK: `-CXXOperatorCallExpr
|
|
// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 'int (*)(int) __arm_streaming const' <FunctionToPointerDecay>
|
|
// CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int (int) __arm_streaming const' lvalue CXXMethod {{.*}} 'operator()' 'int (int) __arm_streaming const'
|
|
int test_lambda(int x) {
|
|
auto F = [](int x) __arm_streaming { return x; };
|
|
return F(x);
|
|
}
|
|
|
|
// CHECK: |-TypedefDecl {{.*}} referenced s_ptrty 'void (*)(int, int) __arm_streaming'
|
|
// CHECK-NEXT: | `-PointerType {{.*}} 'void (*)(int, int) __arm_streaming'
|
|
// CHECK-NEXT: | `-ParenType {{.*}} 'void (int, int) __arm_streaming' sugar
|
|
// CHECK-NEXT: | `-FunctionProtoType {{.*}} 'void (int, int) __arm_streaming' cdecl
|
|
typedef void (*s_ptrty) (int, int) __arm_streaming;
|
|
|
|
// CHECK: `-CXXMethodDecl {{.*}} test_streaming_ptrty 'void (s_ptrty, int, int)' implicit-inline
|
|
// CHECK-NEXT: |-ParmVarDecl {{.*}} used f 's_ptrty':'void (*)(int, int) __arm_streaming'
|
|
// CHECK-NEXT: |-ParmVarDecl {{.*}} used x 'int'
|
|
// CHECK-NEXT: |-ParmVarDecl {{.*}} used y 'int'
|
|
// CHECK: `-CompoundStmt
|
|
// CHECK-NEXT: `-ReturnStmt
|
|
// CHECK-NEXT: `-CallExpr
|
|
// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 's_ptrty':'void (*)(int, int) __arm_streaming' <LValueToRValue>
|
|
// CHECK-NEXT: | `-DeclRefExpr {{.*}} 's_ptrty':'void (*)(int, int) __arm_streaming' lvalue ParmVar {{.*}} 'f' 's_ptrty':'void (*)(int, int) __arm_streaming'
|
|
// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
|
|
// CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int'
|
|
// CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
|
|
// CHECK-NEXT: `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int'
|
|
void test_streaming_ptrty(s_ptrty f, int x, int y) { return f(x, y); };
|
|
};
|