1 | // RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -target-feature +neon -fsyntax-only -verify |
2 | // RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -target-feature +neon -DUSE_LONG -fsyntax-only -verify |
3 | // RUN: %clang_cc1 %s -triple arm64-none-linux-gnu -target-feature +neon -fsyntax-only -verify |
4 | // RUN: %clang_cc1 %s -triple arm64-none-linux-gnu -target-feature +neon -DUSE_LONG -fsyntax-only -verify |
5 | |
6 | typedef float float32_t; |
7 | typedef unsigned char poly8_t; |
8 | typedef unsigned short poly16_t; |
9 | |
10 | // Both "long" and "long long" should work for 64-bit arch like aarch64. |
11 | // stdint.h in gnu libc is using "long" for 64-bit arch. |
12 | #if USE_LONG |
13 | typedef long int64_t; |
14 | typedef unsigned long uint64_t; |
15 | #else |
16 | typedef long long int64_t; |
17 | typedef unsigned long long uint64_t; |
18 | #endif |
19 | typedef uint64_t poly64_t; |
20 | |
21 | // Define some valid Neon types. |
22 | typedef __attribute__((neon_vector_type(2))) int int32x2_t; |
23 | typedef __attribute__((neon_vector_type(4))) int int32x4_t; |
24 | typedef __attribute__((neon_vector_type(1))) int64_t int64x1_t; |
25 | typedef __attribute__((neon_vector_type(2))) int64_t int64x2_t; |
26 | typedef __attribute__((neon_vector_type(1))) uint64_t uint64x1_t; |
27 | typedef __attribute__((neon_vector_type(2))) uint64_t uint64x2_t; |
28 | typedef __attribute__((neon_vector_type(2))) float32_t float32x2_t; |
29 | typedef __attribute__((neon_vector_type(4))) float32_t float32x4_t; |
30 | typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t; |
31 | typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t; |
32 | typedef __attribute__((neon_polyvector_type(1))) poly64_t poly64x1_t; |
33 | typedef __attribute__((neon_polyvector_type(2))) poly64_t poly64x2_t; |
34 | |
35 | // The attributes must have a single argument. |
36 | typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute takes one argument}} |
37 | |
38 | // The number of elements must be an ICE. |
39 | typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{attribute requires an integer constant}} |
40 | |
41 | // Only certain element types are allowed. |
42 | typedef __attribute__((neon_vector_type(2))) double double_elt; |
43 | typedef __attribute__((neon_vector_type(4))) void* ptr_elt; // expected-error{{invalid vector element type}} |
44 | typedef __attribute__((neon_polyvector_type(4))) float32_t bad_poly_elt; // expected-error{{invalid vector element type}} |
45 | struct aggr { signed char c; }; |
46 | typedef __attribute__((neon_vector_type(8))) struct aggr aggregate_elt; // expected-error{{invalid vector element type}} |
47 | |
48 | // The total vector size must be 64 or 128 bits. |
49 | typedef __attribute__((neon_vector_type(1))) int int32x1_t; // expected-error{{Neon vector size must be 64 or 128 bits}} |
50 | typedef __attribute__((neon_vector_type(3))) int int32x3_t; // expected-error{{Neon vector size must be 64 or 128 bits}} |
51 | |