12440fb1f91557912f8c43cb72201170254ae09f4Amara Emerson// RUN: %clang_cc1 %s -triple armv7 -target-feature +neon -fsyntax-only -verify
22440fb1f91557912f8c43cb72201170254ae09f4Amara Emerson// RUN: %clang_cc1 %s -triple armv8 -target-feature +neon -fsyntax-only -verify
3541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
4541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef float float32_t;
5541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef signed char poly8_t;
6541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef short poly16_t;
7651f13cea278ec967336033dd032faef0e9fc2ecStephen Hinestypedef unsigned __INT64_TYPE__ uint64_t;
8541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
9541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// Define some valid Neon types.
10541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(2))) int int32x2_t;
11541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(4))) int int32x4_t;
12541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(1))) uint64_t uint64x1_t;
13541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(2))) uint64_t uint64x2_t;
14541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(2))) float32_t float32x2_t;
15541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_vector_type(4))) float32_t float32x4_t;
16541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_polyvector_type(16))) poly8_t  poly8x16_t;
17541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilsontypedef __attribute__((neon_polyvector_type(8)))  poly16_t poly16x8_t;
18541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
19541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// The attributes must have a single argument.
20baec77865b3ce64bb942dddc5dc2fada84ce5099Aaron Ballmantypedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{'neon_vector_type' attribute takes one argument}}
21541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
22541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// The number of elements must be an ICE.
239f939f75c64770c746d78579f75a49f9c657e426Aaron Ballmantypedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{'neon_vector_type' attribute requires an integer constant}}
24541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson
25541b99466e6b0bce16a105cef2fbfb44e7932e2aBob Wilson// Only certain element types are allowed.
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