]> granicus.if.org Git - clang/commitdiff
For AArch64, support builtin neon vector type with 'long' as base element type.
authorJiangning Liu <jiangning.liu@arm.com>
Wed, 8 Jan 2014 07:51:48 +0000 (07:51 +0000)
committerJiangning Liu <jiangning.liu@arm.com>
Wed, 8 Jan 2014 07:51:48 +0000 (07:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@198741 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp
test/Sema/aarch64-neon-vector-types.c

index 1f8b1eba41e0796da062aaabf526acface71e599..7423a4d0f18d30f0c1aae6bbe55b8eb5381f1242 100644 (file)
@@ -4747,6 +4747,7 @@ static bool isPermittedNeonBaseType(QualType &Ty,
       // AArch64 polynomial vectors are unsigned and support poly64.
       return BTy->getKind() == BuiltinType::UChar ||
              BTy->getKind() == BuiltinType::UShort ||
+             BTy->getKind() == BuiltinType::ULong ||
              BTy->getKind() == BuiltinType::ULongLong;
     } else {
       // AArch32 polynomial vector are signed.
@@ -4766,6 +4767,8 @@ static bool isPermittedNeonBaseType(QualType &Ty,
          BTy->getKind() == BuiltinType::UShort ||
          BTy->getKind() == BuiltinType::Int ||
          BTy->getKind() == BuiltinType::UInt ||
+         BTy->getKind() == BuiltinType::Long ||
+         BTy->getKind() == BuiltinType::ULong ||
          BTy->getKind() == BuiltinType::LongLong ||
          BTy->getKind() == BuiltinType::ULongLong ||
          BTy->getKind() == BuiltinType::Float ||
index 894cf6de1b0c631fcddf4851c895b20453ca94b0..b733e3c276c268faae7306917d25948efb647639 100644 (file)
@@ -1,19 +1,34 @@
 // RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -target-feature +neon -fsyntax-only -verify
+// RUN: %clang_cc1 %s -triple aarch64-none-linux-gnu -target-feature +neon -DUSE_LONG -fsyntax-only -verify
 
 typedef float float32_t;
 typedef unsigned char poly8_t;
 typedef unsigned short poly16_t;
+
+// Both "long" and "long long" should work for 64-bit arch like aarch64.
+// stdint.h in gnu libc is using "long" for 64-bit arch.
+#if USE_LONG
+typedef long int64_t;
+typedef unsigned long uint64_t;
+#else
+typedef long long int64_t;
 typedef unsigned long long uint64_t;
+#endif
+typedef uint64_t poly64_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))) int64_t int64x1_t;
+typedef __attribute__((neon_vector_type(2))) int64_t int64x2_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;
+typedef __attribute__((neon_polyvector_type(1)))  poly64_t poly64x1_t;
+typedef __attribute__((neon_polyvector_type(2)))  poly64_t poly64x2_t;
 
 // The attributes must have a single argument.
 typedef __attribute__((neon_vector_type(2, 4))) int only_one_arg; // expected-error{{attribute takes one argument}}