r198741 - For AArch64, support builtin neon vector type with 'long' as base element type.

Jiangning Liu jiangning.liu at arm.com
Tue Jan 7 23:51:48 PST 2014


Author: jiangning
Date: Wed Jan  8 01:51:48 2014
New Revision: 198741

URL: http://llvm.org/viewvc/llvm-project?rev=198741&view=rev
Log:
For AArch64, support builtin neon vector type with 'long' as base element type.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/Sema/aarch64-neon-vector-types.c

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=198741&r1=198740&r2=198741&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Wed Jan  8 01:51:48 2014
@@ -4747,6 +4747,7 @@ static bool isPermittedNeonBaseType(Qual
       // 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(Qual
          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 ||

Modified: cfe/trunk/test/Sema/aarch64-neon-vector-types.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/aarch64-neon-vector-types.c?rev=198741&r1=198740&r2=198741&view=diff
==============================================================================
--- cfe/trunk/test/Sema/aarch64-neon-vector-types.c (original)
+++ cfe/trunk/test/Sema/aarch64-neon-vector-types.c Wed Jan  8 01:51:48 2014
@@ -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}}





More information about the cfe-commits mailing list