1 // RUN: %clang_cc1 -fsyntax-only -verify -DNONEON -std=c++11 -triple aarch64 %s 2 3 // A target without sve should not be able to use sve types. 4 test_var()5void test_var() { 6 __SVFloat32_t x; // expected-error {{SVE vector type '__SVFloat32_t' cannot be used in a target without sve}} 7 } 8 9 __attribute__((target("sve"))) test_var_target()10void test_var_target() { 11 __SVFloat32_t x; 12 } 13 14 __attribute__((target("sve2"))) test_var_target2()15void test_var_target2() { 16 __SVFloat32_t x; 17 } 18 19 __attribute__((target("sve2-bitperm"))) test_var_target3()20void test_var_target3() { 21 __SVFloat32_t x; 22 } 23 24 __SVFloat32_t other_ret(); test_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}} 27 } 28 29 __attribute__((target("sve"))) test_ret_target()30__SVFloat32_t test_ret_target() { 31 return other_ret(); 32 } 33 test_arg(__SVFloat32_t arg)34void test_arg(__SVFloat32_t arg) { // expected-error {{SVE vector type '__SVFloat32_t' cannot be used in a target without sve}} 35 } 36 37 __attribute__((target("sve"))) test_arg_target(__SVFloat32_t arg)38void test_arg_target(__SVFloat32_t arg) { 39 } 40 test4x()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; 44 } 45 46 __attribute__((target("sve"))) test4x_target()47__clang_svint32x4_t test4x_target() { 48 __clang_svint32x4_t x; 49 return x; 50 } 51 52 // Pointers are still valid to pass around. foo(__SVFloat32_t * & ptrA,__SVFloat32_t * & ptrB)53void foo(__SVFloat32_t *&ptrA, __SVFloat32_t* &ptrB) { 54 ptrA = ptrB; 55 } 56 foo(int x,__SVFloat32_t * ptrA)57__SVFloat32_t* foo(int x, __SVFloat32_t *ptrA) { 58 return ptrA; 59 } 60 61