[PATCH] D79711: [ARM] Add poly64_t on AArch32.

Ties Stuij via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 5 05:29:05 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1e447318339a: [ARM] Add poly64_t on AArch32. (authored by stuij).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79711/new/

https://reviews.llvm.org/D79711

Files:
  clang/include/clang/Basic/TargetBuiltins.h
  clang/lib/AST/ItaniumMangle.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/CodeGen/arm-poly64.c
  clang/utils/TableGen/NeonEmitter.cpp


Index: clang/utils/TableGen/NeonEmitter.cpp
===================================================================
--- clang/utils/TableGen/NeonEmitter.cpp
+++ clang/utils/TableGen/NeonEmitter.cpp
@@ -2233,6 +2233,7 @@
   OS << "#else\n";
   OS << "typedef int8_t poly8_t;\n";
   OS << "typedef int16_t poly16_t;\n";
+  OS << "typedef int64_t poly64_t;\n";
   OS << "#endif\n";
 
   // Emit Neon vector typedefs.
@@ -2245,7 +2246,7 @@
   for (auto &TS : TDTypeVec) {
     bool IsA64 = false;
     Type T(TS, ".");
-    if (T.isDouble() || (T.isPoly() && T.getElementSizeInBits() == 64))
+    if (T.isDouble())
       IsA64 = true;
 
     if (InIfdef && !IsA64) {
@@ -2278,7 +2279,7 @@
     for (auto &TS : TDTypeVec) {
       bool IsA64 = false;
       Type T(TS, ".");
-      if (T.isDouble() || (T.isPoly() && T.getElementSizeInBits() == 64))
+      if (T.isDouble())
         IsA64 = true;
 
       if (InIfdef && !IsA64) {
Index: clang/test/CodeGen/arm-poly64.c
===================================================================
--- /dev/null
+++ clang/test/CodeGen/arm-poly64.c
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple armv8.2a-arm-none-eabi -target-feature +neon \
+// RUN:  -emit-llvm -o - %s | FileCheck %s
+
+// Test that we can use the poly64 type on AArch32
+
+#include <arm_neon.h>
+
+// CHECK-LABEL: @test_poly64
+// CHECK: ret i64 %0
+poly64_t test_poly64(poly64_t a) {
+  return a;
+}
Index: clang/lib/Sema/SemaType.cpp
===================================================================
--- clang/lib/Sema/SemaType.cpp
+++ clang/lib/Sema/SemaType.cpp
@@ -7650,15 +7650,16 @@
                         Triple.getArch() == llvm::Triple::aarch64_be;
   if (VecKind == VectorType::NeonPolyVector) {
     if (IsPolyUnsigned) {
-      // AArch64 polynomial vectors are unsigned and support poly64.
+      // AArch64 polynomial vectors are unsigned.
       return BTy->getKind() == BuiltinType::UChar ||
              BTy->getKind() == BuiltinType::UShort ||
              BTy->getKind() == BuiltinType::ULong ||
              BTy->getKind() == BuiltinType::ULongLong;
     } else {
-      // AArch32 polynomial vector are signed.
+      // AArch32 polynomial vectors are signed.
       return BTy->getKind() == BuiltinType::SChar ||
-             BTy->getKind() == BuiltinType::Short;
+             BTy->getKind() == BuiltinType::Short ||
+             BTy->getKind() == BuiltinType::LongLong;
     }
   }
 
Index: clang/lib/AST/ItaniumMangle.cpp
===================================================================
--- clang/lib/AST/ItaniumMangle.cpp
+++ clang/lib/AST/ItaniumMangle.cpp
@@ -3167,6 +3167,7 @@
     case BuiltinType::UShort:
       EltName = "poly16_t";
       break;
+    case BuiltinType::LongLong:
     case BuiltinType::ULongLong:
       EltName = "poly64_t";
       break;
Index: clang/include/clang/Basic/TargetBuiltins.h
===================================================================
--- clang/include/clang/Basic/TargetBuiltins.h
+++ clang/include/clang/Basic/TargetBuiltins.h
@@ -157,7 +157,7 @@
     EltType getEltType() const { return (EltType)(Flags & EltTypeMask); }
     bool isPoly() const {
       EltType ET = getEltType();
-      return ET == Poly8 || ET == Poly16;
+      return ET == Poly8 || ET == Poly16 || ET == Poly64;
     }
     bool isUnsigned() const { return (Flags & UnsignedFlag) != 0; }
     bool isQuad() const { return (Flags & QuadFlag) != 0; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79711.268756.patch
Type: text/x-patch
Size: 3411 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200605/5bafaeb2/attachment.bin>


More information about the cfe-commits mailing list