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 3 4 typedef float float32_t; 5 typedef signed char poly8_t; 6 typedef short poly16_t; 7 typedef unsigned __INT64_TYPE__ uint64_t; 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 // Verify that we can use the [[]] spelling of the attributes. 20 // We intentionally use the same type alias names to check that both versions 21 // define the same type. 22 typedef int [[clang::neon_vector_type(2)]] int32x2_t; 23 typedef poly8_t [[clang::neon_polyvector_type(16)]] poly8x16_t; 24 25 // Verify that we can use the attributes outside of a typedef. 26 int [[clang::neon_vector_type(2)]] int32x2_var; 27 poly8_t [[clang::neon_polyvector_type(16)]] poly8x16_var; 28 29 // The attributes must have a single argument. 30 typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{'neon_vector_type' attribute takes one argument}} 31 32 // The number of elements must be an ICE. 33 typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{'neon_vector_type' attribute requires an integer constant}} 34 35 // Only certain element types are allowed. 36 typedef __attribute__((neon_vector_type(4))) void* ptr_elt; // expected-error{{invalid vector element type}} 37 typedef __attribute__((neon_polyvector_type(4))) float32_t bad_poly_elt; // expected-error{{invalid vector element type}} 38 struct aggr { signed char c; }; 39 typedef __attribute__((neon_vector_type(8))) struct aggr aggregate_elt; // expected-error{{invalid vector element type}} 40 41 // The total vector size must be 64 or 128 bits. 42 typedef __attribute__((neon_vector_type(1))) int int32x1_t; // expected-error{{Neon vector size must be 64 or 128 bits}} 43 typedef __attribute__((neon_vector_type(3))) int int32x3_t; // expected-error{{Neon vector size must be 64 or 128 bits}} 44