1541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// RUN: %clang_cc1 %s -fsyntax-only -verify
2541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
3541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef float float32_t;
4541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef signed char poly8_t;
5541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef short poly16_t;
6541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef unsigned long long uint64_t;
7541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
8541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// Define some valid Neon types.
9541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(2))) int int32x2_t;
10541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(4))) int int32x4_t;
11541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(1))) uint64_t uint64x1_t;
12541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(2))) uint64_t uint64x2_t;
13541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(2))) float32_t float32x2_t;
14541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(4))) float32_t float32x4_t;
15541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_polyvector_type(16))) poly8_t  poly8x16_t;
16541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_polyvector_type(8)))  poly16_t poly16x8_t;
17541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
18541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// The attributes must have a single argument.
19bdc49d360f98c1194d50b8bbb24885bf8d4c1ac4John McCalltypedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute takes one argument}}
20541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
21541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// The number of elements must be an ICE.
22541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{attribute requires integer constant}}
23541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
24541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// Only certain element types are allowed.
25541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(2))) double double_elt; // expected-error{{invalid vector element type}}
26541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(4))) void* ptr_elt; // expected-error{{invalid vector element type}}
27541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_polyvector_type(4))) float32_t bad_poly_elt; // expected-error{{invalid vector element type}}
28541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsonstruct aggr { signed char c; };
29541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(8))) struct aggr aggregate_elt; // expected-error{{invalid vector element type}}
30541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
31541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// The total vector size must be 64 or 128 bits.
32541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(1))) int int32x1_t; // expected-error{{Neon vector size must be 64 or 128 bits}}
33541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(3))) int int32x3_t; // expected-error{{Neon vector size must be 64 or 128 bits}}
34