diff options
author | Bob Wilson <bob.wilson@apple.com> | 2010-11-16 00:32:28 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2010-11-16 00:32:28 +0000 |
commit | 541b99466e6b0bce16a105cef2fbfb44e7932e2a (patch) | |
tree | 93419628268e740f2da59fbb14dc85e0aeec6d29 | |
parent | ec33cbeab96f33007ac19a57bab454519cd94fe9 (diff) |
Add tests for new Neon vector type attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119303 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Sema/neon-vector-types.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Sema/neon-vector-types.c b/test/Sema/neon-vector-types.c new file mode 100644 index 0000000000..1f501776cc --- /dev/null +++ b/test/Sema/neon-vector-types.c @@ -0,0 +1,33 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify + +typedef float float32_t; +typedef signed char poly8_t; +typedef short poly16_t; +typedef unsigned long long uint64_t; + +// Define some valid Neon types. +typedef __attribute__((neon_vector_type(2))) int int32x2_t; +typedef __attribute__((neon_vector_type(4))) int int32x4_t; +typedef __attribute__((neon_vector_type(1))) uint64_t uint64x1_t; +typedef __attribute__((neon_vector_type(2))) uint64_t uint64x2_t; +typedef __attribute__((neon_vector_type(2))) float32_t float32x2_t; +typedef __attribute__((neon_vector_type(4))) float32_t float32x4_t; +typedef __attribute__((neon_polyvector_type(16))) poly8_t poly8x16_t; +typedef __attribute__((neon_polyvector_type(8))) poly16_t poly16x8_t; + +// The attributes must have a single argument. +typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute requires 1 argument(s)}} + +// The number of elements must be an ICE. +typedef __attribute__((neon_vector_type(2.0))) int non_int_width; // expected-error{{attribute requires integer constant}} + +// Only certain element types are allowed. +typedef __attribute__((neon_vector_type(2))) double double_elt; // expected-error{{invalid vector element type}} +typedef __attribute__((neon_vector_type(4))) void* ptr_elt; // expected-error{{invalid vector element type}} +typedef __attribute__((neon_polyvector_type(4))) float32_t bad_poly_elt; // expected-error{{invalid vector element type}} +struct aggr { signed char c; }; +typedef __attribute__((neon_vector_type(8))) struct aggr aggregate_elt; // expected-error{{invalid vector element type}} + +// The total vector size must be 64 or 128 bits. +typedef __attribute__((neon_vector_type(1))) int int32x1_t; // expected-error{{Neon vector size must be 64 or 128 bits}} +typedef __attribute__((neon_vector_type(3))) int int32x3_t; // expected-error{{Neon vector size must be 64 or 128 bits}} |