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