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