61 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify -DNONEON -std=c++11 -triple aarch64 %s2 3// A target without sve should not be able to use sve types.4 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")))10void test_var_target() {11 __SVFloat32_t x;12}13 14__attribute__((target("sve2")))15void test_var_target2() {16 __SVFloat32_t x;17}18 19__attribute__((target("sve2-bitperm")))20void test_var_target3() {21 __SVFloat32_t x;22}23 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}}27}28 29__attribute__((target("sve")))30__SVFloat32_t test_ret_target() {31 return other_ret();32}33 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")))38void test_arg_target(__SVFloat32_t arg) {39}40 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")))47__clang_svint32x4_t test4x_target() {48 __clang_svint32x4_t x;49 return x;50}51 52// Pointers are still valid to pass around.53void foo(__SVFloat32_t *&ptrA, __SVFloat32_t* &ptrB) {54 ptrA = ptrB;55}56 57__SVFloat32_t* foo(int x, __SVFloat32_t *ptrA) {58 return ptrA;59}60 61