Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions clang/lib/AST/ItaniumMangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4328,9 +4328,13 @@ void CXXNameMangler::mangleRISCVFixedRVVVectorType(
void CXXNameMangler::mangleType(const VectorType *T) {
if ((T->getVectorKind() == VectorKind::Neon ||
T->getVectorKind() == VectorKind::NeonPoly)) {
llvm::Triple Target = getASTContext().getTargetInfo().getTriple();
llvm::Triple::ArchType Arch =
getASTContext().getTargetInfo().getTriple().getArch();
const TargetInfo *TI = getASTContext().getLangOpts().isTargetDevice()
? getASTContext().getAuxTargetInfo()
: &getASTContext().getTargetInfo();
if (!TI)
TI = &getASTContext().getTargetInfo();
llvm::Triple Target = TI->getTriple();
llvm::Triple::ArchType Arch = Target.getArch();
if ((Arch == llvm::Triple::aarch64 ||
Arch == llvm::Triple::aarch64_be) && !Target.isOSDarwin())
mangleAArch64NeonVectorType(T);
Expand Down
7 changes: 3 additions & 4 deletions clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8556,10 +8556,9 @@ static bool isPermittedNeonBaseType(QualType &Ty, VectorKind VecKind, Sema &S) {
if (VecKind == VectorKind::NeonPoly) {
if (IsPolyUnsigned) {
// AArch64 polynomial vectors are unsigned.
return BTy->getKind() == BuiltinType::UChar ||
BTy->getKind() == BuiltinType::UShort ||
BTy->getKind() == BuiltinType::ULong ||
BTy->getKind() == BuiltinType::ULongLong;
auto bitwidth = S.Context.getTypeSize(BTy);
return BTy->isUnsignedInteger() &&
(bitwidth == 8 || bitwidth == 16 || bitwidth == 64);
} else {
// AArch32 polynomial vectors are signed.
return BTy->getKind() == BuiltinType::SChar ||
Expand Down
22 changes: 22 additions & 0 deletions clang/test/SemaSYCL/neon-polyvector-types.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Does a run with a SYCL device, where neon polyvector type errors are ignored.
// afterwards compile for the host where neon polyvector type errors aren't ignored

// polyvector type errors get ignored with SYCL enabled
// RUN: %clang_cc1 %s -fsycl-is-device -triple spir64 -aux-triple arm64-unknown-linux-gnu -target-feature +neon -fsyntax-only -verify=quiet

// diagnostic for bad_poly32_t
// RUN: %clang_cc1 %s -triple arm64-unknown-linux-gnu -target-feature +neon -fsyntax-only -verify
typedef unsigned char poly8_t;
typedef unsigned short poly16_t;
typedef unsigned long poly64_t;

typedef unsigned int bad_poly32_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(2))) poly64_t poly64x2_t;
Comment thread
tahonermann marked this conversation as resolved.

// this error will get ignored when running SYCL
// quiet-no-diagnostics
typedef __attribute__((neon_polyvector_type(2))) bad_poly32_t bad_poly32x2_t;
// expected-error@-1{{invalid vector element type}}