Debian Codegraph @

clang/test/Sema/arm-sve-target.cpp

raw
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
5 void 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")))
10 void test_var_target() {
11 __SVFloat32_t x;
12 }
13
14 __attribute__((target("sve2")))
15 void test_var_target2() {
16 __SVFloat32_t x;
17 }
18
19 __attribute__((target("sve2-bitperm")))
20 void 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
34 void 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")))
38 void 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.
53 void 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