[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / arm-sve-target.cpp
blob1567475e681da3de550dab2d37a98873769764b0
1 // RUN: %clang_cc1 -fsyntax-only -verify -DNONEON -std=c++11 -triple aarch64 %s
3 // A target without sve should not be able to use sve types.
5 void test_var() {
6 __SVFloat32_t x; // expected-error {{SVE vector type '__SVFloat32_t' cannot be used in a target without sve}}
9 __attribute__((target("sve")))
10 void test_var_target() {
11 __SVFloat32_t x;
14 __attribute__((target("sve2")))
15 void test_var_target2() {
16 __SVFloat32_t x;
19 __attribute__((target("sve2-bitperm")))
20 void test_var_target3() {
21 __SVFloat32_t x;
24 __SVFloat32_t other_ret();
25 __SVFloat32_t test_ret() { // expected-error {{SVE vector type '__SVFloat32_t' cannot be used in a target without sve}}
26 return other_ret(); // expected-error {{SVE vector type '__SVFloat32_t' cannot be used in a target without sve}}
29 __attribute__((target("sve")))
30 __SVFloat32_t test_ret_target() {
31 return other_ret();
34 void test_arg(__SVFloat32_t arg) { // expected-error {{SVE vector type '__SVFloat32_t' cannot be used in a target without sve}}
37 __attribute__((target("sve")))
38 void test_arg_target(__SVFloat32_t arg) {
41 __clang_svint32x4_t test4x() { // expected-error {{SVE vector type '__clang_svint32x4_t' cannot be used in a target without sve}}
42 __clang_svint32x4_t x; // expected-error {{SVE vector type '__clang_svint32x4_t' cannot be used in a target without sve}}
43 return x;
46 __attribute__((target("sve")))
47 __clang_svint32x4_t test4x_target() {
48 __clang_svint32x4_t x;
49 return x;
52 // Pointers are still valid to pass around.
53 void foo(__SVFloat32_t *&ptrA, __SVFloat32_t* &ptrB) {
54 ptrA = ptrB;
57 __SVFloat32_t* foo(int x, __SVFloat32_t *ptrA) {
58 return ptrA;