Hi,
As suggested by John in his review of the AArch64 backend, I'm splitting this
change into a separate thread.
I'd like to make the ARM NEON polynomial types be based on unsigned variants
(unsigned char, unsigned short) rather than the present signed ones.
The AArch32 (i.e. "ARM") procedure call standard leaves this detail
unspecified, merely saying that they represent polynomials over GF(2).
However, the AArch64 PCS says that they correspond to unsigned types.
Since the 32-bit ABI is compatible with this, I think it would be better to
bring them into alignment rather than adding unnecessary target
conditionalisation to Clang.
Ok to commit?
Cheers.
Tim.
commit aa35a73a7ce698be3e9e6ba3ae5c4763a27e2533
Author: Tim Northover <[email protected]>
Date: Mon Jan 14 11:42:38 2013 +0000
Switch NEON polynomial types to be based on unsigned rather than signed.
The 32-bit ABI leaves the signedness of these polynomial types unspecified, but
the AArch64 one requires them to be unsigned. To avoid unnecessary
conditionalisation, the best option is to make AArch32 variants unsigned as
well.
diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp
index 65e630e..89f286b 100644
--- a/lib/AST/ItaniumMangle.cpp
+++ b/lib/AST/ItaniumMangle.cpp
@@ -2073,8 +2073,8 @@ void CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
const char *EltName = 0;
if (T->getVectorKind() == VectorType::NeonPolyVector) {
switch (cast<BuiltinType>(EltType)->getKind()) {
- case BuiltinType::SChar: EltName = "poly8_t"; break;
- case BuiltinType::Short: EltName = "poly16_t"; break;
+ case BuiltinType::UChar: EltName = "poly8_t"; break;
+ case BuiltinType::UShort: EltName = "poly16_t"; break;
default: llvm_unreachable("unexpected Neon polynomial vector element type");
}
} else {
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 3b1dac3..4acadf2 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -4131,8 +4131,8 @@ static void HandleNeonVectorTypeAttr(QualType& CurType,
const BuiltinType* BTy = CurType->getAs<BuiltinType>();
if (!BTy ||
(VecKind == VectorType::NeonPolyVector &&
- BTy->getKind() != BuiltinType::SChar &&
- BTy->getKind() != BuiltinType::Short) ||
+ BTy->getKind() != BuiltinType::UChar &&
+ BTy->getKind() != BuiltinType::UShort) ||
(BTy->getKind() != BuiltinType::SChar &&
BTy->getKind() != BuiltinType::UChar &&
BTy->getKind() != BuiltinType::Short &&
diff --git a/test/CodeGenCXX/mangle-neon-vectors.cpp b/test/CodeGenCXX/mangle-neon-vectors.cpp
index 3723deb..d998a96 100644
--- a/test/CodeGenCXX/mangle-neon-vectors.cpp
+++ b/test/CodeGenCXX/mangle-neon-vectors.cpp
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
typedef float float32_t;
-typedef signed char poly8_t;
-typedef short poly16_t;
+typedef unsigned char poly8_t;
+typedef unsigned short poly16_t;
typedef unsigned long long uint64_t;
typedef __attribute__((neon_vector_type(2))) int int32x2_t;
diff --git a/test/Sema/neon-vector-types.c b/test/Sema/neon-vector-types.c
index cbf0133..f4ef4a4 100644
--- a/test/Sema/neon-vector-types.c
+++ b/test/Sema/neon-vector-types.c
@@ -1,8 +1,8 @@
// RUN: %clang_cc1 %s -fsyntax-only -verify
typedef float float32_t;
-typedef signed char poly8_t;
-typedef short poly16_t;
+typedef unsigned char poly8_t;
+typedef unsigned short poly16_t;
typedef unsigned long long uint64_t;
// Define some valid Neon types.
diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp
index d453ede..6721b43 100644
--- a/utils/TableGen/NeonEmitter.cpp
+++ b/utils/TableGen/NeonEmitter.cpp
@@ -1301,8 +1301,8 @@ void NeonEmitter::run(raw_ostream &OS) {
// Emit NEON-specific scalar typedefs.
OS << "typedef float float32_t;\n";
- OS << "typedef int8_t poly8_t;\n";
- OS << "typedef int16_t poly16_t;\n";
+ OS << "typedef uint8_t poly8_t;\n";
+ OS << "typedef uint16_t poly16_t;\n";
OS << "typedef uint16_t float16_t;\n";
// Emit Neon vector typedefs._______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits