mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-21 15:02:51 +00:00
[ARM] Add poly64_t on AArch32.
Summary: The poly64 types are guarded with ifdefs for AArch64 only. This is wrong. This was also incorrectly documented in the ACLE spec, but this has been rectified in the latest release. See paragraph 13.1.2 "Vector data types": https://developer.arm.com/docs/101028/latest This patch was written by Alexandros Lamprineas. Reviewers: ostannard, sdesmalen, fpetrogalli, labrinea, t.p.northover, LukeGeeson Reviewed By: ostannard Subscribers: pbarrio, LukeGeeson, kristof.beyls, danielkiss, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D79711
This commit is contained in:
parent
66a1b83bf9
commit
1e44731833
@ -157,7 +157,7 @@ namespace clang {
|
||||
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; }
|
||||
|
@ -3167,6 +3167,7 @@ void CXXNameMangler::mangleNeonVectorType(const VectorType *T) {
|
||||
case BuiltinType::UShort:
|
||||
EltName = "poly16_t";
|
||||
break;
|
||||
case BuiltinType::LongLong:
|
||||
case BuiltinType::ULongLong:
|
||||
EltName = "poly64_t";
|
||||
break;
|
||||
|
@ -7650,15 +7650,16 @@ static bool isPermittedNeonBaseType(QualType &Ty,
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
12
clang/test/CodeGen/arm-poly64.c
Normal file
12
clang/test/CodeGen/arm-poly64.c
Normal file
@ -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;
|
||||
}
|
@ -2233,6 +2233,7 @@ void NeonEmitter::run(raw_ostream &OS) {
|
||||
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 @@ void NeonEmitter::run(raw_ostream &OS) {
|
||||
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 @@ void NeonEmitter::run(raw_ostream &OS) {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user