Amara Emerson | 2440fb1 | 2013-09-16 18:07:35 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple armv7 -target-feature +neon -fsyntax-only -verify |
| 2 | // RUN: %clang_cc1 %s -triple armv8 -target-feature +neon -fsyntax-only -verify |
Bob Wilson | 541b994 | 2010-11-16 00:32:28 +0000 | [diff] [blame] | 3 | |
| 4 | typedef float float32_t; |
| 5 | typedef signed char poly8_t; |
| 6 | typedef short poly16_t; |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame^] | 7 | typedef unsigned __INT64_TYPE__ uint64_t; |
Bob Wilson | 541b994 | 2010-11-16 00:32:28 +0000 | [diff] [blame] | 8 | |
| 9 | // Define some valid Neon types. |
| 10 | typedef __attribute__((neon_vector_type(2))) int int32x2_t; |
| 11 | typedef __attribute__((neon_vector_type(4))) int int32x4_t; |
| 12 | typedef __attribute__((neon_vector_type(1))) uint64_t uint64x1_t; |
| 13 | typedef __attribute__((neon_vector_type(2))) uint64_t uint64x2_t; |
| 14 | typedef __attribute__((neon_vector_type(2))) float32_t float32x2_t; |
| 15 | typedef __attribute__((neon_vector_type(4))) float32_t float32x4_t; |
| 16 | typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t; |
| 17 | typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t; |
| 18 | |
| 19 | // The attributes must have a single argument. |
Aaron Ballman | baec778 | 2013-07-23 19:30:11 +0000 | [diff] [blame] | 20 | typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{'neon_vector_type' attribute takes one argument}} |
Bob Wilson | 541b994 | 2010-11-16 00:32:28 +0000 | [diff] [blame] | 21 | |
| 22 | // The number of elements must be an ICE. |
Aaron Ballman | 9f939f7 | 2013-07-30 14:10:17 +0000 | [diff] [blame] | 23 | typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{'neon_vector_type' attribute requires an integer constant}} |
Bob Wilson | 541b994 | 2010-11-16 00:32:28 +0000 | [diff] [blame] | 24 | |
| 25 | // Only certain element types are allowed. |
Bob Wilson | 541b994 | 2010-11-16 00:32:28 +0000 | [diff] [blame] | 26 | typedef __attribute__((neon_vector_type(4))) void* ptr_elt; // expected-error{{invalid vector element type}} |
| 27 | typedef __attribute__((neon_polyvector_type(4))) float32_t bad_poly_elt; // expected-error{{invalid vector element type}} |
| 28 | struct aggr { signed char c; }; |
| 29 | typedef __attribute__((neon_vector_type(8))) struct aggr aggregate_elt; // expected-error{{invalid vector element type}} |
| 30 | |
| 31 | // The total vector size must be 64 or 128 bits. |
| 32 | typedef __attribute__((neon_vector_type(1))) int int32x1_t; // expected-error{{Neon vector size must be 64 or 128 bits}} |
| 33 | typedef __attribute__((neon_vector_type(3))) int int32x3_t; // expected-error{{Neon vector size must be 64 or 128 bits}} |