Skip to content

Commit cfea753

Browse files
committed
[clang]: fix __neon_vector__type support when using OpenMP offloading
1 parent d841c88 commit cfea753

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clang/lib/Sema/SemaType.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8336,12 +8336,11 @@ static bool verifyValidIntegerConstantExpr(Sema &S, const ParsedAttr &Attr,
83368336
/// match one of the standard Neon vector types.
83378337
static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr,
83388338
Sema &S, VectorKind VecKind) {
8339-
bool IsTargetCUDAAndHostARM = false;
8340-
if (S.getLangOpts().CUDAIsDevice) {
8341-
const TargetInfo *AuxTI = S.getASTContext().getAuxTargetInfo();
8342-
IsTargetCUDAAndHostARM =
8343-
AuxTI && (AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM());
8344-
}
8339+
const TargetInfo *AuxTI = S.getASTContext().getAuxTargetInfo();
8340+
bool IsArm = AuxTI->getTriple().isAArch64() || AuxTI->getTriple().isARM();
8341+
8342+
bool IsTargetCUDAAndHostARM = IsArm && S.getLangOpts().CUDAIsDevice;
8343+
bool IsTargetOpenMPDeviceAndHostARM = IsArm && S.getLangOpts().OpenMPIsTargetDevice;
83458344

83468345
// Target must have NEON (or MVE, whose vectors are similar enough
83478346
// not to need a separate attribute)
@@ -8376,7 +8375,7 @@ static void HandleNeonVectorTypeAttr(QualType &CurType, const ParsedAttr &Attr,
83768375

83778376
// Only certain element types are supported for Neon vectors.
83788377
if (!isPermittedNeonBaseType(CurType, VecKind, S) &&
8379-
!IsTargetCUDAAndHostARM) {
8378+
!IsTargetCUDAAndHostARM && !IsTargetOpenMPDeviceAndHostARM) {
83808379
S.Diag(Attr.getLoc(), diag::err_attribute_invalid_vector_type) << CurType;
83818380
Attr.setInvalid();
83828381
return;

0 commit comments

Comments
 (0)