diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -9167,8 +9167,12 @@ "threadprivate variable with incomplete type %0">; def err_omp_no_dsa_for_variable : Error< "variable %0 must have explicitly specified data sharing attributes">; +def err_omp_defaultmap_no_attr_for_variable : Error< + "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">; def note_omp_default_dsa_none : Note< "explicit data sharing attribute requested here">; +def note_omp_defaultmap_attr_none : Note< + "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">; def err_omp_wrong_dsa : Error< "%0 variable cannot be %1">; def err_omp_variably_modified_type_not_supported : Error< @@ -9597,6 +9601,8 @@ "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'" >, InGroup; def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">; +def err_omp_one_defaultmap_each_category: Error< + "at most one defaultmap clause for each variable-category can appear on the directive">; } // end of OpenMP category let CategoryName = "Related Result Type Issue" in { diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def --- a/clang/include/clang/Basic/OpenMPKinds.def +++ b/clang/include/clang/Basic/OpenMPKinds.def @@ -435,9 +435,17 @@ // Static attributes for 'defaultmap' clause. OPENMP_DEFAULTMAP_KIND(scalar) +OPENMP_DEFAULTMAP_KIND(aggregate) +OPENMP_DEFAULTMAP_KIND(pointer) // Modifiers for 'defaultmap' clause. +OPENMP_DEFAULTMAP_MODIFIER(alloc) +OPENMP_DEFAULTMAP_MODIFIER(to) +OPENMP_DEFAULTMAP_MODIFIER(from) OPENMP_DEFAULTMAP_MODIFIER(tofrom) +OPENMP_DEFAULTMAP_MODIFIER(firstprivate) +OPENMP_DEFAULTMAP_MODIFIER(none) +OPENMP_DEFAULTMAP_MODIFIER(default) // Static attributes for 'depend' clause. OPENMP_DEPEND_KIND(in) diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -2018,15 +2018,15 @@ case OMPC_defaultmap: // OpenMP [2.7.1, Restrictions, p. 3] // Only one schedule clause can appear on a loop directive. - // OpenMP [2.10.4, Restrictions, p. 106] + // OpenMP 4.5 [2.10.4, Restrictions, p. 106] // At most one defaultmap clause can appear on the directive. - if (!FirstClause) { + if ((getLangOpts().OpenMP < 50 || CKind != OMPC_defaultmap) && + !FirstClause) { Diag(Tok, diag::err_omp_more_one_clause) << getOpenMPDirectiveName(DKind) << getOpenMPClauseName(CKind) << 0; ErrorFound = true; } LLVM_FALLTHROUGH; - case OMPC_if: Clause = ParseOpenMPSingleExprWithArgClause(CKind, WrongDirective); break; @@ -2310,8 +2310,13 @@ DelimLoc = ConsumeAnyToken(); } else if (Kind == OMPC_defaultmap) { // Get a defaultmap modifier - Arg.push_back(getOpenMPSimpleClauseType( - Kind, Tok.isAnnotation() ? "" : PP.getSpelling(Tok))); + unsigned Modifier = getOpenMPSimpleClauseType( + Kind, Tok.isAnnotation() ? "" : PP.getSpelling(Tok)); + // Set defaultmap modifier to unknown if it is either scalar, aggregate, or + // pointer + if (Modifier < OMPC_DEFAULTMAP_MODIFIER_unknown) + Modifier = OMPC_DEFAULTMAP_MODIFIER_unknown; + Arg.push_back(Modifier); KLoc.push_back(Tok.getLocation()); if (Tok.isNot(tok::r_paren) && Tok.isNot(tok::comma) && Tok.isNot(tok::annot_pragma_openmp_end)) diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -48,12 +48,6 @@ DSA_shared = 1 << 1, /// Default data sharing attribute 'shared'. }; -/// Attributes of the defaultmap clause. -enum DefaultMapAttributes { - DMA_unspecified, /// Default mapping is not specified. - DMA_tofrom_scalar, /// Default mapping is 'tofrom:scalar'. -}; - /// Stack for tracking declarations used in OpenMP directives and /// clauses and their data-sharing attributes. class DSAStackTy { @@ -115,6 +109,14 @@ }; using DeclReductionMapTy = llvm::SmallDenseMap; + struct DefaultmapInfo { + OpenMPDefaultmapClauseModifier ImplicitBehavior = + OMPC_DEFAULTMAP_MODIFIER_unknown; + SourceLocation SLoc; + DefaultmapInfo() = default; + DefaultmapInfo(OpenMPDefaultmapClauseModifier M, SourceLocation Loc) + : ImplicitBehavior(M), SLoc(Loc) {} + }; struct SharingMapTy { DeclSAMapTy SharingMap; @@ -124,8 +126,7 @@ LoopControlVariablesMapTy LCVMap; DefaultDataSharingAttributes DefaultAttr = DSA_unspecified; SourceLocation DefaultAttrLoc; - DefaultMapAttributes DefaultMapAttr = DMA_unspecified; - SourceLocation DefaultMapAttrLoc; + DefaultmapInfo DefaultmapMap[OMPC_DEFAULTMAP_unknown]; OpenMPDirectiveKind Directive = OMPD_unknown; DeclarationNameInfo DirectiveName; Scope *CurScope = nullptr; @@ -592,10 +593,18 @@ getTopOfStack().DefaultAttr = DSA_shared; getTopOfStack().DefaultAttrLoc = Loc; } - /// Set default data mapping attribute to 'tofrom:scalar'. - void setDefaultDMAToFromScalar(SourceLocation Loc) { - getTopOfStack().DefaultMapAttr = DMA_tofrom_scalar; - getTopOfStack().DefaultMapAttrLoc = Loc; + /// Set default data mapping attribute to Modifier:Kind + void setDefaultDMAAttr(OpenMPDefaultmapClauseModifier M, + OpenMPDefaultmapClauseKind Kind, + SourceLocation Loc) { + DefaultmapInfo &DMI = getTopOfStack().DefaultmapMap[Kind]; + DMI.ImplicitBehavior = M; + DMI.SLoc = Loc; + } + /// Check whether the implicit-behavior has been set in defaultmap + bool checkDefaultmapCategory(OpenMPDefaultmapClauseKind VariableCategory) { + return getTopOfStack().DefaultmapMap[VariableCategory].ImplicitBehavior != + OMPC_DEFAULTMAP_MODIFIER_unknown; } DefaultDataSharingAttributes getDefaultDSA() const { @@ -606,16 +615,52 @@ return isStackEmpty() ? SourceLocation() : getTopOfStack().DefaultAttrLoc; } - DefaultMapAttributes getDefaultDMA() const { - return isStackEmpty() ? DMA_unspecified - : getTopOfStack().DefaultMapAttr; + OpenMPDefaultmapClauseModifier + getDefaultmapModifier(OpenMPDefaultmapClauseKind Kind) const { + return isStackEmpty() + ? OMPC_DEFAULTMAP_MODIFIER_unknown + : getTopOfStack().DefaultmapMap[Kind].ImplicitBehavior; + } + OpenMPDefaultmapClauseModifier + getDefaultmapModifierAtLevel(unsigned Level, + OpenMPDefaultmapClauseKind Kind) const { + return getStackElemAtLevel(Level).DefaultmapMap[Kind].ImplicitBehavior; + } + bool isDefaultmapCapturedByRef(unsigned Level, + OpenMPDefaultmapClauseKind Kind) const { + OpenMPDefaultmapClauseModifier M = + getDefaultmapModifierAtLevel(Level, Kind); + if (Kind == OMPC_DEFAULTMAP_scalar || Kind == OMPC_DEFAULTMAP_pointer) { + return (M == OMPC_DEFAULTMAP_MODIFIER_alloc) || + (M == OMPC_DEFAULTMAP_MODIFIER_to) || + (M == OMPC_DEFAULTMAP_MODIFIER_from) || + (M == OMPC_DEFAULTMAP_MODIFIER_tofrom); + } + return true; + } + static bool mustBeFirstprivateBase(OpenMPDefaultmapClauseModifier M, + OpenMPDefaultmapClauseKind Kind) { + switch (Kind) { + case OMPC_DEFAULTMAP_scalar: + case OMPC_DEFAULTMAP_pointer: + return (M == OMPC_DEFAULTMAP_MODIFIER_unknown) || + (M == OMPC_DEFAULTMAP_MODIFIER_firstprivate) || + (M == OMPC_DEFAULTMAP_MODIFIER_default); + case OMPC_DEFAULTMAP_aggregate: + return M == OMPC_DEFAULTMAP_MODIFIER_firstprivate; + case OMPC_DEFAULTMAP_unknown: + llvm_unreachable("Unexpected variable category"); + } } - DefaultMapAttributes getDefaultDMAAtLevel(unsigned Level) const { - return getStackElemAtLevel(Level).DefaultMapAttr; + bool mustBeFirstprivateAtLevel(unsigned Level, + OpenMPDefaultmapClauseKind Kind) const { + OpenMPDefaultmapClauseModifier M = + getDefaultmapModifierAtLevel(Level, Kind); + return mustBeFirstprivateBase(M, Kind); } - SourceLocation getDefaultDMALocation() const { - return isStackEmpty() ? SourceLocation() - : getTopOfStack().DefaultMapAttrLoc; + bool mustBeFirstprivate(OpenMPDefaultmapClauseKind Kind) const { + OpenMPDefaultmapClauseModifier M = getDefaultmapModifier(Kind); + return mustBeFirstprivateBase(M, Kind); } /// Checks if the specified variable is a threadprivate. @@ -1716,6 +1761,15 @@ << Context.getTargetInfo().getTriple().str() << E->getSourceRange(); } +static OpenMPDefaultmapClauseKind +getVariableCategoryFromDecl(const ValueDecl *VD) { + if (VD->getType().getNonReferenceType()->isAnyPointerType()) + return OMPC_DEFAULTMAP_pointer; + if (VD->getType().getNonReferenceType()->isScalarType()) + return OMPC_DEFAULTMAP_scalar; + return OMPC_DEFAULTMAP_aggregate; +} + bool Sema::isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, unsigned OpenMPCaptureLevel) const { assert(LangOpts.OpenMP && "OpenMP is not allowed"); @@ -1834,11 +1888,13 @@ } else { // By default, all the data that has a scalar type is mapped by copy // (except for reduction variables). + // Defaultmap scalar is mutual exclusive to defaultmap pointer IsByRef = (DSAStack->isForceCaptureByReferenceInTargetExecutable() && !Ty->isAnyPointerType()) || !Ty->isScalarType() || - DSAStack->getDefaultDMAAtLevel(Level) == DMA_tofrom_scalar || + DSAStack->isDefaultmapCapturedByRef(Level, + getVariableCategoryFromDecl(D)) || DSAStack->hasExplicitDSA( D, [](OpenMPClauseKind K) { return K == OMPC_reduction; }, Level); } @@ -2055,9 +2111,8 @@ if (DSAStack->hasExplicitDirective(isOpenMPTargetExecutionDirective, NewLevel)) { OMPC = OMPC_map; - if (D->getType()->isScalarType() && - DSAStack->getDefaultDMAAtLevel(NewLevel) != - DefaultMapAttributes::DMA_tofrom_scalar) + if (DSAStack->mustBeFirstprivateAtLevel(NewLevel, + getVariableCategoryFromDecl(D))) OMPC = OMPC_firstprivate; break; } @@ -2763,6 +2818,42 @@ } } +static OpenMPMapClauseKind +getMapClauseKindFromModifier(OpenMPDefaultmapClauseModifier M, + bool IsAggregateOrDeclareTarget) { + OpenMPMapClauseKind Kind = OMPC_MAP_unknown; + switch (M) { + case OMPC_DEFAULTMAP_MODIFIER_alloc: + Kind = OMPC_MAP_alloc; + break; + case OMPC_DEFAULTMAP_MODIFIER_to: + Kind = OMPC_MAP_to; + break; + case OMPC_DEFAULTMAP_MODIFIER_from: + Kind = OMPC_MAP_from; + break; + case OMPC_DEFAULTMAP_MODIFIER_tofrom: + Kind = OMPC_MAP_tofrom; + break; + case OMPC_DEFAULTMAP_MODIFIER_firstprivate: + case OMPC_DEFAULTMAP_MODIFIER_last: + llvm_unreachable("Unexpected defaultmap implicit behavior"); + case OMPC_DEFAULTMAP_MODIFIER_none: + case OMPC_DEFAULTMAP_MODIFIER_default: + case OMPC_DEFAULTMAP_MODIFIER_unknown: + // IsAggregateOrDeclareTarget could be true if: + // 1. the implicit behavior for aggregate is tofrom + // 2. it's a declare target link/to + if (IsAggregateOrDeclareTarget) { + Kind = OMPC_MAP_tofrom; + break; + } + llvm_unreachable("Unexpected defaultmap implicit behavior"); + } + assert(Kind != OMPC_MAP_unknown && "Expect map kind to be known"); + return Kind; +} + namespace { class DSAAttrChecker final : public StmtVisitor { DSAStackTy *Stack; @@ -2771,7 +2862,7 @@ bool TryCaptureCXXThisMembers = false; CapturedStmt *CS = nullptr; llvm::SmallVector ImplicitFirstprivate; - llvm::SmallVector ImplicitMap; + llvm::SmallVector ImplicitMap[OMPC_MAP_delete]; Sema::VarsWithInheritedDSAType VarsWithInheritedDSA; llvm::SmallDenseSet ImplicitDeclarations; @@ -2844,6 +2935,39 @@ return; } + // OpenMP 5.0 [2.19.7.2, defaultmap clause, Description] + // If implicit-behavior is none, each variable referenced in the + // construct that does not have a predetermined data-sharing attribute + // and does not appear in a to or link clause on a declare target + // directive must be listed in a data-mapping attribute clause, a + // data-haring attribute clause (including a data-sharing attribute + // clause on a combined construct where target. is one of the + // constituent constructs), or an is_device_ptr clause. + OpenMPDefaultmapClauseKind ClauseKind = getVariableCategoryFromDecl(VD); + if (SemaRef.getLangOpts().OpenMP >= 50) { + bool IsModifierNone = Stack->getDefaultmapModifier(ClauseKind) == + OMPC_DEFAULTMAP_MODIFIER_none; + if (DVar.CKind == OMPC_unknown && IsModifierNone && + VarsWithInheritedDSA.count(VD) == 0 && + (!(isOpenMPTargetExecutionDirective(DKind) && Res))) { + // Only check for data-mapping attribute and is_device_ptr here + // since we have already make sure that the declaration does not + // have a data-sharing attribute above + if (!Stack->checkMappableExprComponentListsForDecl( + VD, /*CurrentRegionOnly=*/true, + [VD](OMPClauseMappableExprCommon::MappableExprComponentListRef + MapExprComponents, + OpenMPClauseKind) { + auto MI = MapExprComponents.rbegin(); + auto ME = MapExprComponents.rend(); + return MI != ME && MI->getAssociatedDeclaration() == VD; + })) { + VarsWithInheritedDSA[VD] = E; + return; + } + } + } + if (isOpenMPTargetExecutionDirective(DKind) && !Stack->isLoopControlVariable(VD).first) { if (!Stack->checkMappableExprComponentListsForDecl( @@ -2873,13 +2997,16 @@ VD->getType().getNonReferenceType()->getAsCXXRecordDecl()) IsFirstprivate = RD->isLambda(); IsFirstprivate = - IsFirstprivate || - (VD->getType().getNonReferenceType()->isScalarType() && - Stack->getDefaultDMA() != DMA_tofrom_scalar && !Res); - if (IsFirstprivate) + IsFirstprivate || (Stack->mustBeFirstprivate(ClauseKind) && !Res); + if (IsFirstprivate) { ImplicitFirstprivate.emplace_back(E); - else - ImplicitMap.emplace_back(E); + } else { + OpenMPDefaultmapClauseModifier M = + Stack->getDefaultmapModifier(ClauseKind); + OpenMPMapClauseKind Kind = getMapClauseKindFromModifier( + M, ClauseKind == OMPC_DEFAULTMAP_aggregate || Res); + ImplicitMap[Kind].emplace_back(E); + } return; } } @@ -2958,7 +3085,11 @@ if (Stack->isClassPreviouslyMapped(TE->getType())) return; - ImplicitMap.emplace_back(E); + OpenMPDefaultmapClauseModifier Modifier = + Stack->getDefaultmapModifier(OMPC_DEFAULTMAP_aggregate); + OpenMPMapClauseKind Kind = getMapClauseKindFromModifier( + Modifier, /*IsAggregateOrDeclareTarget*/ true); + ImplicitMap[Kind].emplace_back(E); return; } @@ -3087,7 +3218,9 @@ ArrayRef getImplicitFirstprivate() const { return ImplicitFirstprivate; } - ArrayRef getImplicitMap() const { return ImplicitMap; } + ArrayRef getImplicitMap(OpenMPDefaultmapClauseKind Kind) const { + return ImplicitMap[Kind]; + } const Sema::VarsWithInheritedDSAType &getVarsWithInheritedDSA() const { return VarsWithInheritedDSA; } @@ -4299,8 +4432,12 @@ SmallVector ImplicitFirstprivates( DSAChecker.getImplicitFirstprivate().begin(), DSAChecker.getImplicitFirstprivate().end()); - SmallVector ImplicitMaps(DSAChecker.getImplicitMap().begin(), - DSAChecker.getImplicitMap().end()); + SmallVector ImplicitMaps[OMPC_MAP_delete]; + for (unsigned I = 0; I < OMPC_MAP_delete; ++I) { + ArrayRef ImplicitMap = + DSAChecker.getImplicitMap(static_cast(I)); + ImplicitMaps[I].append(ImplicitMap.begin(), ImplicitMap.end()); + } // Mark taskgroup task_reduction descriptors as implicitly firstprivate. for (OMPClause *C : Clauses) { if (auto *IRC = dyn_cast(C)) { @@ -4320,16 +4457,21 @@ ErrorFound = true; } } - if (!ImplicitMaps.empty()) { + unsigned ClauseKindCnt = -1; + for (ArrayRef ImplicitMap : ImplicitMaps) { + ++ClauseKindCnt; + if (ImplicitMap.empty()) + continue; CXXScopeSpec MapperIdScopeSpec; DeclarationNameInfo MapperId; + auto Kind = static_cast(ClauseKindCnt); if (OMPClause *Implicit = ActOnOpenMPMapClause( - llvm::None, llvm::None, MapperIdScopeSpec, MapperId, - OMPC_MAP_tofrom, /*IsMapTypeImplicit=*/true, SourceLocation(), - SourceLocation(), ImplicitMaps, OMPVarListLocTy())) { + llvm::None, llvm::None, MapperIdScopeSpec, MapperId, Kind, + /*IsMapTypeImplicit=*/true, SourceLocation(), SourceLocation(), + ImplicitMap, OMPVarListLocTy())) { ClausesWithImplicit.emplace_back(Implicit); ErrorFound |= - cast(Implicit)->varlist_size() != ImplicitMaps.size(); + cast(Implicit)->varlist_size() != ImplicitMap.size(); } else { ErrorFound = true; } @@ -4705,9 +4847,17 @@ if (P.getFirst()->isImplicit() || isa(P.getFirst())) continue; ErrorFound = true; - Diag(P.second->getExprLoc(), diag::err_omp_no_dsa_for_variable) - << P.first << P.second->getSourceRange(); - Diag(DSAStack->getDefaultDSALocation(), diag::note_omp_default_dsa_none); + if (DSAStack->getDefaultDSA() == DSA_none) { + Diag(P.second->getExprLoc(), diag::err_omp_no_dsa_for_variable) + << P.first << P.second->getSourceRange(); + Diag(DSAStack->getDefaultDSALocation(), diag::note_omp_default_dsa_none); + } else if (getLangOpts().OpenMP >= 50) { + Diag(P.second->getExprLoc(), + diag::err_omp_defaultmap_no_attr_for_variable) + << P.first << P.second->getSourceRange(); + Diag(DSAStack->getDefaultDSALocation(), + diag::note_omp_defaultmap_attr_none); + } } if (!AllowedNameModifiers.empty()) @@ -16264,26 +16414,57 @@ OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc) { - // OpenMP 4.5 only supports 'defaultmap(tofrom: scalar)' - if (M != OMPC_DEFAULTMAP_MODIFIER_tofrom || Kind != OMPC_DEFAULTMAP_scalar) { - std::string Value; - SourceLocation Loc; - Value += "'"; - if (M != OMPC_DEFAULTMAP_MODIFIER_tofrom) { - Value += getOpenMPSimpleClauseTypeName(OMPC_defaultmap, - OMPC_DEFAULTMAP_MODIFIER_tofrom); - Loc = MLoc; - } else { - Value += getOpenMPSimpleClauseTypeName(OMPC_defaultmap, - OMPC_DEFAULTMAP_scalar); - Loc = KindLoc; + if (getLangOpts().OpenMP < 50) { + if (M != OMPC_DEFAULTMAP_MODIFIER_tofrom || + Kind != OMPC_DEFAULTMAP_scalar) { + std::string Value; + SourceLocation Loc; + Value += "'"; + if (M != OMPC_DEFAULTMAP_MODIFIER_tofrom) { + Value += getOpenMPSimpleClauseTypeName(OMPC_defaultmap, + OMPC_DEFAULTMAP_MODIFIER_tofrom); + Loc = MLoc; + } else { + Value += getOpenMPSimpleClauseTypeName(OMPC_defaultmap, + OMPC_DEFAULTMAP_scalar); + Loc = KindLoc; + } + Value += "'"; + Diag(Loc, diag::err_omp_unexpected_clause_value) + << Value << getOpenMPClauseName(OMPC_defaultmap); + return nullptr; + } + } else { + bool isDefaultmapModifier = (M != OMPC_DEFAULTMAP_MODIFIER_unknown); + bool isDefaultmapKind = (Kind != OMPC_DEFAULTMAP_unknown); + if (!isDefaultmapKind || !isDefaultmapModifier) { + std::string ModifierValue = "'alloc', 'from', 'to', 'tofrom', " + "'firstprivate', 'none', 'default'"; + std::string KindValue = "'scalar', 'aggregate', 'pointer'"; + if (!isDefaultmapKind && isDefaultmapModifier) { + Diag(KindLoc, diag::err_omp_unexpected_clause_value) + << KindValue << getOpenMPClauseName(OMPC_defaultmap); + } else if (isDefaultmapKind && !isDefaultmapModifier) { + Diag(MLoc, diag::err_omp_unexpected_clause_value) + << ModifierValue << getOpenMPClauseName(OMPC_defaultmap); + } else { + Diag(MLoc, diag::err_omp_unexpected_clause_value) + << ModifierValue << getOpenMPClauseName(OMPC_defaultmap); + Diag(KindLoc, diag::err_omp_unexpected_clause_value) + << KindValue << getOpenMPClauseName(OMPC_defaultmap); + } + return nullptr; + } + + // OpenMP [5.0, 2.12.5, Restrictions, p. 174] + // At most one defaultmap clause for each category can appear on the + // directive. + if (DSAStack->checkDefaultmapCategory(Kind)) { + Diag(StartLoc, diag::err_omp_one_defaultmap_each_category); + return nullptr; } - Value += "'"; - Diag(Loc, diag::err_omp_unexpected_clause_value) - << Value << getOpenMPClauseName(OMPC_defaultmap); - return nullptr; } - DSAStack->setDefaultDMAToFromScalar(StartLoc); + DSAStack->setDefaultDMAAttr(M, Kind, StartLoc); return new (Context) OMPDefaultmapClause(StartLoc, LParenLoc, MLoc, KindLoc, EndLoc, Kind, M); diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -1984,6 +1984,21 @@ return getSema().ActOnOpenMPIsDevicePtrClause(VarList, Locs); } + /// Build a new OpenMP 'defaultmap' clause. + /// + /// By default, performs semantic analysis to build the new OpenMP clause. + /// Subclasses may override this routine to provide different behavior. + OMPClause *RebuildOMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, + OpenMPDefaultmapClauseKind Kind, + SourceLocation StartLoc, + SourceLocation LParenLoc, + SourceLocation MLoc, + SourceLocation KindLoc, + SourceLocation EndLoc) { + return getSema().ActOnOpenMPDefaultmapClause(M, Kind, StartLoc, LParenLoc, + MLoc, KindLoc, EndLoc); + } + /// Rebuild the operand to an Objective-C \@synchronized statement. /// /// By default, performs semantic analysis to build the new statement. @@ -9185,7 +9200,15 @@ template OMPClause * TreeTransform::TransformOMPDefaultmapClause(OMPDefaultmapClause *C) { - return C; + // Rebuild Defaultmap Clause since we need to invoke the checking of + // defaultmap(none:variable-category) after template initialization. + return getDerived().RebuildOMPDefaultmapClause(C->getDefaultmapModifier(), + C->getDefaultmapKind(), + C->getBeginLoc(), + C->getLParenLoc(), + C->getDefaultmapModifierLoc(), + C->getDefaultmapKindLoc(), + C->getEndLoc()); } template diff --git a/clang/test/OpenMP/target_ast_print.cpp b/clang/test/OpenMP/target_ast_print.cpp --- a/clang/test/OpenMP/target_ast_print.cpp +++ b/clang/test/OpenMP/target_ast_print.cpp @@ -1,17 +1,355 @@ -// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s | FileCheck %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s - -// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s | FileCheck %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s -// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s // expected-no-diagnostics - #ifndef HEADER #define HEADER +// RUN: %clang_cc1 -DOMP45 -verify -fopenmp -fopenmp-version=45 -ast-print %s | FileCheck %s --check-prefix=OMP45 +// RUN: %clang_cc1 -DOMP45 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -DOMP45 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix=OMP45 + +// RUN: %clang_cc1 -DOMP45 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s | FileCheck %s --check-prefix=OMP45 +// RUN: %clang_cc1 -DOMP45 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -DOMP45 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix=OMP45 +#ifdef OMP45 + +void foo() {} + +template +T tmain(T argc, T *argv) { + T i, j, a[20], always, close; +#pragma omp target + foo(); +#pragma omp target if (target:argc > 0) + foo(); +#pragma omp target if (C) + foo(); +#pragma omp target map(i) + foo(); +#pragma omp target map(a[0:10], i) + foo(); +#pragma omp target map(to: i) map(from: j) + foo(); +#pragma omp target map(always,alloc: i) + foo(); +#pragma omp target map(always from: i) + foo(); +#pragma omp target map(always) + {always++;} +#pragma omp target map(always,i) + {always++;i++;} +#pragma omp target map(close,alloc: i) + foo(); +#pragma omp target map(close from: i) + foo(); +#pragma omp target map(close) + {close++;} +#pragma omp target map(close,i) + {close++;i++;} +#pragma omp target nowait + foo(); +#pragma omp target depend(in : argc, argv[i:argc], a[:]) + foo(); +#pragma omp target defaultmap(tofrom: scalar) + foo(); + return 0; +} + +// OMP45: template T tmain(T argc, T *argv) { +// OMP45-NEXT: T i, j, a[20] +// OMP45-NEXT: #pragma omp target{{$}} +// OMP45-NEXT: foo(); +// OMP45-NEXT: #pragma omp target if(target: argc > 0) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target if(C) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: a[0:10],i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(to: i) map(from: j) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(always,alloc: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(always,from: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: always) +// OMP45-NEXT: { +// OMP45-NEXT: always++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(tofrom: always,i) +// OMP45-NEXT: { +// OMP45-NEXT: always++; +// OMP45-NEXT: i++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(close,alloc: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(close,from: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: close) +// OMP45-NEXT: { +// OMP45-NEXT: close++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(tofrom: close,i) +// OMP45-NEXT: { +// OMP45-NEXT: close++; +// OMP45-NEXT: i++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target nowait +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target defaultmap(tofrom: scalar) +// OMP45-NEXT: foo() +// OMP45: template<> int tmain(int argc, int *argv) { +// OMP45-NEXT: int i, j, a[20] +// OMP45-NEXT: #pragma omp target +// OMP45-NEXT: foo(); +// OMP45-NEXT: #pragma omp target if(target: argc > 0) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target if(5) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: a[0:10],i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(to: i) map(from: j) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(always,alloc: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(always,from: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: always) +// OMP45-NEXT: { +// OMP45-NEXT: always++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(tofrom: always,i) +// OMP45-NEXT: { +// OMP45-NEXT: always++; +// OMP45-NEXT: i++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(close,alloc: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(close,from: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: close) +// OMP45-NEXT: { +// OMP45-NEXT: close++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(tofrom: close,i) +// OMP45-NEXT: { +// OMP45-NEXT: close++; +// OMP45-NEXT: i++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target nowait +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target defaultmap(tofrom: scalar) +// OMP45-NEXT: foo() +// OMP45: template<> char tmain(char argc, char *argv) { +// OMP45-NEXT: char i, j, a[20] +// OMP45-NEXT: #pragma omp target +// OMP45-NEXT: foo(); +// OMP45-NEXT: #pragma omp target if(target: argc > 0) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target if(1) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: a[0:10],i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(to: i) map(from: j) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(always,alloc: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(always,from: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: always) +// OMP45-NEXT: { +// OMP45-NEXT: always++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(tofrom: always,i) +// OMP45-NEXT: { +// OMP45-NEXT: always++; +// OMP45-NEXT: i++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(close,alloc: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(close,from: i) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target map(tofrom: close) +// OMP45-NEXT: { +// OMP45-NEXT: close++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target map(tofrom: close,i) +// OMP45-NEXT: { +// OMP45-NEXT: close++; +// OMP45-NEXT: i++; +// OMP45-NEXT: } +// OMP45-NEXT: #pragma omp target nowait +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) +// OMP45-NEXT: foo() +// OMP45-NEXT: #pragma omp target defaultmap(tofrom: scalar) +// OMP45-NEXT: foo() + +// OMP45-LABEL: class S { +class S { + void foo() { +// OMP45-NEXT: void foo() { + int a = 0; +// OMP45-NEXT: int a = 0; + #pragma omp target map(this[0]) +// OMP45-NEXT: #pragma omp target map(tofrom: this[0]) + a++; +// OMP45-NEXT: a++; + #pragma omp target map(this[:1]) +// OMP45-NEXT: #pragma omp target map(tofrom: this[:1]) + a++; +// OMP45-NEXT: a++; + #pragma omp target map((this)[0]) +// OMP45-NEXT: #pragma omp target map(tofrom: (this)[0]) + a++; +// OMP45-NEXT: a++; + #pragma omp target map(this[:a]) +// OMP45-NEXT: #pragma omp target map(tofrom: this[:a]) + a++; +// OMP45-NEXT: a++; + #pragma omp target map(this[a:1]) +// OMP45-NEXT: #pragma omp target map(tofrom: this[a:1]) + a++; +// OMP45-NEXT: a++; + #pragma omp target map(this[a]) +// OMP45-NEXT: #pragma omp target map(tofrom: this[a]) + a++; +// OMP45-NEXT: a++; + } +// OMP45-NEXT: } +}; +// OMP45-NEXT: }; + +// OMP45-LABEL: int main(int argc, char **argv) { +int main (int argc, char **argv) { + int i, j, a[20], always, close; +// OMP45-NEXT: int i, j, a[20] +#pragma omp target +// OMP45-NEXT: #pragma omp target + foo(); +// OMP45-NEXT: foo(); +#pragma omp target if (argc > 0) +// OMP45-NEXT: #pragma omp target if(argc > 0) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(i) if(argc>0) +// OMP45-NEXT: #pragma omp target map(tofrom: i) if(argc > 0) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(i) +// OMP45-NEXT: #pragma omp target map(tofrom: i) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(a[0:10], i) +// OMP45-NEXT: #pragma omp target map(tofrom: a[0:10],i) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(to: i) map(from: j) +// OMP45-NEXT: #pragma omp target map(to: i) map(from: j) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(always,alloc: i) +// OMP45-NEXT: #pragma omp target map(always,alloc: i) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(always from: i) +// OMP45-NEXT: #pragma omp target map(always,from: i) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(always) +// OMP45-NEXT: #pragma omp target map(tofrom: always) + {always++;} +// OMP45-NEXT: { +// OMP45-NEXT: always++; +// OMP45-NEXT: } + +#pragma omp target map(always,i) +// OMP45-NEXT: #pragma omp target map(tofrom: always,i) + {always++;i++;} +// OMP45-NEXT: { +// OMP45-NEXT: always++; +// OMP45-NEXT: i++; +// OMP45-NEXT: } + +#pragma omp target map(close,alloc: i) +// OMP45-NEXT: #pragma omp target map(close,alloc: i) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(close from: i) +// OMP45-NEXT: #pragma omp target map(close,from: i) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target map(close) +// OMP45-NEXT: #pragma omp target map(tofrom: close) + {close++;} +// OMP45-NEXT: { +// OMP45-NEXT: close++; +// OMP45-NEXT: } + +#pragma omp target map(close,i) +// OMP45-NEXT: #pragma omp target map(tofrom: close,i) + {close++;i++;} +// OMP45-NEXT: { +// OMP45-NEXT: close++; +// OMP45-NEXT: i++; +// OMP45-NEXT: } + +#pragma omp target nowait +// OMP45-NEXT: #pragma omp target nowait + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target depend(in : argc, argv[i:argc], a[:]) +// OMP45-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) + foo(); +// OMP45-NEXT: foo(); + +#pragma omp target defaultmap(tofrom: scalar) +// OMP45-NEXT: #pragma omp target defaultmap(tofrom: scalar) + foo(); +// OMP45-NEXT: foo(); + + return tmain(argc, &argc) + tmain(argv[0][0], argv[0]); +} + +#endif + +#ifdef OMP5 + +///==========================================================================/// +// RUN: %clang_cc1 -DOMP5 -verify -fopenmp -fopenmp-version=50 -ast-print %s | FileCheck %s --check-prefix OMP5 +// RUN: %clang_cc1 -DOMP5 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -DOMP5 -fopenmp -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix OMP5 + +// RUN: %clang_cc1 -DOMP5 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s | FileCheck %s --check-prefix OMP5 +// RUN: %clang_cc1 -DOMP5 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -DOMP5 -fopenmp-simd -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix OMP5 + void foo() {} +#pragma omp declare target +void bar() {} +#pragma omp end declare target + +int a; +#pragma omp declare target link(a) + template T tmain(T argc, T *argv) { T i, j, a[20], always, close; @@ -47,284 +385,671 @@ foo(); #pragma omp target depend(in : argc, argv[i:argc], a[:]) foo(); +#pragma omp target defaultmap(alloc: scalar) + foo(); +#pragma omp target defaultmap(to: scalar) + foo(); +#pragma omp target defaultmap(from: scalar) + foo(); #pragma omp target defaultmap(tofrom: scalar) foo(); +#pragma omp target defaultmap(firstprivate: scalar) + foo(); +#pragma omp target defaultmap(none: scalar) + foo(); +#pragma omp target defaultmap(default: scalar) + foo(); +#pragma omp target defaultmap(alloc: aggregate) + foo(); +#pragma omp target defaultmap(to: aggregate) + foo(); +#pragma omp target defaultmap(from: aggregate) + foo(); +#pragma omp target defaultmap(tofrom: aggregate) + foo(); +#pragma omp target defaultmap(firstprivate: aggregate) + foo(); +#pragma omp target defaultmap(none: aggregate) + foo(); +#pragma omp target defaultmap(default: aggregate) + foo(); +#pragma omp target defaultmap(alloc: pointer) + foo(); +#pragma omp target defaultmap(to: pointer) + foo(); +#pragma omp target defaultmap(from: pointer) + foo(); +#pragma omp target defaultmap(tofrom: pointer) + foo(); +#pragma omp target defaultmap(firstprivate: pointer) + foo(); +#pragma omp target defaultmap(none: pointer) + foo(); +#pragma omp target defaultmap(default: pointer) + foo(); +#pragma omp target defaultmap(to: scalar) defaultmap(tofrom: pointer) + foo(); +#pragma omp target defaultmap(from: pointer) defaultmap(none: aggregate) + foo(); +#pragma omp target defaultmap(default: aggregate) defaultmap(alloc: scalar) + foo(); +#pragma omp target defaultmap(alloc: aggregate) defaultmap(firstprivate: scalar) defaultmap(tofrom: pointer) + foo(); +#pragma omp target defaultmap(tofrom: aggregate) defaultmap(to: pointer) defaultmap(alloc: scalar) + foo(); + + int *g; + +#pragma omp target is_device_ptr(g) defaultmap(none: pointer) + g++; +#pragma omp target private(g) defaultmap(none: pointer) + g++; +#pragma omp target firstprivate(g) defaultmap(none: pointer) + g++; +#pragma omp target defaultmap(none: scalar) map(to: i) + i++; +#pragma omp target defaultmap(none: aggregate) map(to: a) + a[3]++; +#pragma omp target defaultmap(none: scalar) + bar(); + return 0; } -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T i, j, a[20] -// CHECK-NEXT: #pragma omp target{{$}} -// CHECK-NEXT: foo(); -// CHECK-NEXT: #pragma omp target if(target: argc > 0) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target if(C) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: a[0:10],i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(to: i) map(from: j) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(always,alloc: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(always,from: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: always) -// CHECK-NEXT: { -// CHECK-NEXT: always++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(tofrom: always,i) -// CHECK-NEXT: { -// CHECK-NEXT: always++; -// CHECK-NEXT: i++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(close,alloc: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(close,from: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: close) -// CHECK-NEXT: { -// CHECK-NEXT: close++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(tofrom: close,i) -// CHECK-NEXT: { -// CHECK-NEXT: close++; -// CHECK-NEXT: i++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target nowait -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar) -// CHECK-NEXT: foo() -// CHECK: template<> int tmain(int argc, int *argv) { -// CHECK-NEXT: int i, j, a[20] -// CHECK-NEXT: #pragma omp target -// CHECK-NEXT: foo(); -// CHECK-NEXT: #pragma omp target if(target: argc > 0) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target if(5) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: a[0:10],i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(to: i) map(from: j) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(always,alloc: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(always,from: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: always) -// CHECK-NEXT: { -// CHECK-NEXT: always++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(tofrom: always,i) -// CHECK-NEXT: { -// CHECK-NEXT: always++; -// CHECK-NEXT: i++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(close,alloc: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(close,from: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: close) -// CHECK-NEXT: { -// CHECK-NEXT: close++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(tofrom: close,i) -// CHECK-NEXT: { -// CHECK-NEXT: close++; -// CHECK-NEXT: i++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target nowait -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar) -// CHECK-NEXT: foo() -// CHECK: template<> char tmain(char argc, char *argv) { -// CHECK-NEXT: char i, j, a[20] -// CHECK-NEXT: #pragma omp target -// CHECK-NEXT: foo(); -// CHECK-NEXT: #pragma omp target if(target: argc > 0) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target if(1) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: a[0:10],i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(to: i) map(from: j) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(always,alloc: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(always,from: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: always) -// CHECK-NEXT: { -// CHECK-NEXT: always++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(tofrom: always,i) -// CHECK-NEXT: { -// CHECK-NEXT: always++; -// CHECK-NEXT: i++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(close,alloc: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(close,from: i) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target map(tofrom: close) -// CHECK-NEXT: { -// CHECK-NEXT: close++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target map(tofrom: close,i) -// CHECK-NEXT: { -// CHECK-NEXT: close++; -// CHECK-NEXT: i++; -// CHECK-NEXT: } -// CHECK-NEXT: #pragma omp target nowait -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar) -// CHECK-NEXT: foo() - -// CHECK-LABEL: class S { +// OMP5: template T tmain(T argc, T *argv) { +// OMP5-NEXT: T i, j, a[20] +// OMP5-NEXT: #pragma omp target{{$}} +// OMP5-NEXT: foo(); +// OMP5-NEXT: #pragma omp target if(target: argc > 0) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target if(C) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: a[0:10],i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(to: i) map(from: j) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(always,alloc: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(always,from: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: always) +// OMP5-NEXT: { +// OMP5-NEXT: always++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(tofrom: always,i) +// OMP5-NEXT: { +// OMP5-NEXT: always++; +// OMP5-NEXT: i++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(close,alloc: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(close,from: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: close) +// OMP5-NEXT: { +// OMP5-NEXT: close++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(tofrom: close,i) +// OMP5-NEXT: { +// OMP5-NEXT: close++; +// OMP5-NEXT: i++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target nowait +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: scalar) defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: pointer) defaultmap(none: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: aggregate) defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: aggregate) defaultmap(firstprivate: scalar) defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: aggregate) defaultmap(to: pointer) defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5: template<> int tmain(int argc, int *argv) { +// OMP5-NEXT: int i, j, a[20] +// OMP5-NEXT: #pragma omp target +// OMP5-NEXT: foo(); +// OMP5-NEXT: #pragma omp target if(target: argc > 0) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target if(5) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: a[0:10],i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(to: i) map(from: j) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(always,alloc: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(always,from: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: always) +// OMP5-NEXT: { +// OMP5-NEXT: always++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(tofrom: always,i) +// OMP5-NEXT: { +// OMP5-NEXT: always++; +// OMP5-NEXT: i++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(close,alloc: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(close,from: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: close) +// OMP5-NEXT: { +// OMP5-NEXT: close++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(tofrom: close,i) +// OMP5-NEXT: { +// OMP5-NEXT: close++; +// OMP5-NEXT: i++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target nowait +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: scalar) defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: pointer) defaultmap(none: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: aggregate) defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: aggregate) defaultmap(firstprivate: scalar) defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: aggregate) defaultmap(to: pointer) defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5: template<> char tmain(char argc, char *argv) { +// OMP5-NEXT: char i, j, a[20] +// OMP5-NEXT: #pragma omp target +// OMP5-NEXT: foo(); +// OMP5-NEXT: #pragma omp target if(target: argc > 0) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target if(1) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: a[0:10],i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(to: i) map(from: j) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(always,alloc: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(always,from: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: always) +// OMP5-NEXT: { +// OMP5-NEXT: always++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(tofrom: always,i) +// OMP5-NEXT: { +// OMP5-NEXT: always++; +// OMP5-NEXT: i++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(close,alloc: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(close,from: i) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target map(tofrom: close) +// OMP5-NEXT: { +// OMP5-NEXT: close++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target map(tofrom: close,i) +// OMP5-NEXT: { +// OMP5-NEXT: close++; +// OMP5-NEXT: i++; +// OMP5-NEXT: } +// OMP5-NEXT: #pragma omp target nowait +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(none: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(to: scalar) defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(from: pointer) defaultmap(none: aggregate) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(default: aggregate) defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(alloc: aggregate) defaultmap(firstprivate: scalar) defaultmap(tofrom: pointer) +// OMP5-NEXT: foo() +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: aggregate) defaultmap(to: pointer) defaultmap(alloc: scalar) +// OMP5-NEXT: foo() +// OMP5-NEXT: int *g; +// OMP5-NEXT: #pragma omp target is_device_ptr(g) defaultmap(none: pointer) +// OMP5-NEXT: g++; +// OMP5-NEXT: #pragma omp target private(g) defaultmap(none: pointer) +// OMP5-NEXT: g++; +// OMP5-NEXT: #pragma omp target firstprivate(g) defaultmap(none: pointer) +// OMP5-NEXT: g++; +// OMP5-NEXT: #pragma omp target defaultmap(none: scalar) map(to: i) +// OMP5-NEXT: i++; +// OMP5-NEXT: #pragma omp target defaultmap(none: aggregate) map(to: a) +// OMP5-NEXT: a[3]++; +// OMP5-NEXT: #pragma omp target defaultmap(none: scalar) +// OMP5-NEXT: bar(); + +// OMP5-LABEL: class S { class S { void foo() { -// CHECK-NEXT: void foo() { +// OMP5-NEXT: void foo() { int a = 0; -// CHECK-NEXT: int a = 0; +// OMP5-NEXT: int a = 0; #pragma omp target map(this[0]) -// CHECK-NEXT: #pragma omp target map(tofrom: this[0]) +// OMP5-NEXT: #pragma omp target map(tofrom: this[0]) a++; -// CHECK-NEXT: a++; +// OMP5-NEXT: a++; #pragma omp target map(this[:1]) -// CHECK-NEXT: #pragma omp target map(tofrom: this[:1]) +// OMP5-NEXT: #pragma omp target map(tofrom: this[:1]) a++; -// CHECK-NEXT: a++; +// OMP5-NEXT: a++; #pragma omp target map((this)[0]) -// CHECK-NEXT: #pragma omp target map(tofrom: (this)[0]) +// OMP5-NEXT: #pragma omp target map(tofrom: (this)[0]) a++; -// CHECK-NEXT: a++; +// OMP5-NEXT: a++; #pragma omp target map(this[:a]) -// CHECK-NEXT: #pragma omp target map(tofrom: this[:a]) +// OMP5-NEXT: #pragma omp target map(tofrom: this[:a]) a++; -// CHECK-NEXT: a++; +// OMP5-NEXT: a++; #pragma omp target map(this[a:1]) -// CHECK-NEXT: #pragma omp target map(tofrom: this[a:1]) +// OMP5-NEXT: #pragma omp target map(tofrom: this[a:1]) a++; -// CHECK-NEXT: a++; +// OMP5-NEXT: a++; #pragma omp target map(this[a]) -// CHECK-NEXT: #pragma omp target map(tofrom: this[a]) +// OMP5-NEXT: #pragma omp target map(tofrom: this[a]) a++; -// CHECK-NEXT: a++; +// OMP5-NEXT: a++; } -// CHECK-NEXT: } +// OMP5-NEXT: } }; -// CHECK-NEXT: }; +// OMP5-NEXT: }; -// CHECK-LABEL: int main(int argc, char **argv) { +// OMP5-LABEL: int main(int argc, char **argv) { int main (int argc, char **argv) { int i, j, a[20], always, close; -// CHECK-NEXT: int i, j, a[20] +// OMP5-NEXT: int i, j, a[20] #pragma omp target -// CHECK-NEXT: #pragma omp target +// OMP5-NEXT: #pragma omp target foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target if (argc > 0) -// CHECK-NEXT: #pragma omp target if(argc > 0) +// OMP5-NEXT: #pragma omp target if(argc > 0) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(i) if(argc>0) -// CHECK-NEXT: #pragma omp target map(tofrom: i) if(argc > 0) +// OMP5-NEXT: #pragma omp target map(tofrom: i) if(argc > 0) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(i) -// CHECK-NEXT: #pragma omp target map(tofrom: i) +// OMP5-NEXT: #pragma omp target map(tofrom: i) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(a[0:10], i) -// CHECK-NEXT: #pragma omp target map(tofrom: a[0:10],i) +// OMP5-NEXT: #pragma omp target map(tofrom: a[0:10],i) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(to: i) map(from: j) -// CHECK-NEXT: #pragma omp target map(to: i) map(from: j) +// OMP5-NEXT: #pragma omp target map(to: i) map(from: j) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(always,alloc: i) -// CHECK-NEXT: #pragma omp target map(always,alloc: i) +// OMP5-NEXT: #pragma omp target map(always,alloc: i) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(always from: i) -// CHECK-NEXT: #pragma omp target map(always,from: i) +// OMP5-NEXT: #pragma omp target map(always,from: i) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(always) -// CHECK-NEXT: #pragma omp target map(tofrom: always) +// OMP5-NEXT: #pragma omp target map(tofrom: always) {always++;} -// CHECK-NEXT: { -// CHECK-NEXT: always++; -// CHECK-NEXT: } +// OMP5-NEXT: { +// OMP5-NEXT: always++; +// OMP5-NEXT: } #pragma omp target map(always,i) -// CHECK-NEXT: #pragma omp target map(tofrom: always,i) +// OMP5-NEXT: #pragma omp target map(tofrom: always,i) {always++;i++;} -// CHECK-NEXT: { -// CHECK-NEXT: always++; -// CHECK-NEXT: i++; -// CHECK-NEXT: } +// OMP5-NEXT: { +// OMP5-NEXT: always++; +// OMP5-NEXT: i++; +// OMP5-NEXT: } #pragma omp target map(close,alloc: i) -// CHECK-NEXT: #pragma omp target map(close,alloc: i) +// OMP5-NEXT: #pragma omp target map(close,alloc: i) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(close from: i) -// CHECK-NEXT: #pragma omp target map(close,from: i) +// OMP5-NEXT: #pragma omp target map(close,from: i) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target map(close) -// CHECK-NEXT: #pragma omp target map(tofrom: close) +// OMP5-NEXT: #pragma omp target map(tofrom: close) {close++;} -// CHECK-NEXT: { -// CHECK-NEXT: close++; -// CHECK-NEXT: } +// OMP5-NEXT: { +// OMP5-NEXT: close++; +// OMP5-NEXT: } #pragma omp target map(close,i) -// CHECK-NEXT: #pragma omp target map(tofrom: close,i) +// OMP5-NEXT: #pragma omp target map(tofrom: close,i) {close++;i++;} -// CHECK-NEXT: { -// CHECK-NEXT: close++; -// CHECK-NEXT: i++; -// CHECK-NEXT: } +// OMP5-NEXT: { +// OMP5-NEXT: close++; +// OMP5-NEXT: i++; +// OMP5-NEXT: } #pragma omp target nowait -// CHECK-NEXT: #pragma omp target nowait +// OMP5-NEXT: #pragma omp target nowait foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target depend(in : argc, argv[i:argc], a[:]) -// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) +// OMP5-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:]) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(alloc: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(alloc: scalar) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(to: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(to: scalar) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(from: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(from: scalar) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); #pragma omp target defaultmap(tofrom: scalar) -// CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: scalar) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(firstprivate: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: scalar) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(none: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(none: scalar) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(default: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(default: scalar) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(alloc: aggregate) +// OMP5-NEXT: #pragma omp target defaultmap(alloc: aggregate) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(to: aggregate) +// OMP5-NEXT: #pragma omp target defaultmap(to: aggregate) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(from: aggregate) +// OMP5-NEXT: #pragma omp target defaultmap(from: aggregate) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(tofrom: aggregate) +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: aggregate) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(firstprivate: aggregate) +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: aggregate) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(none: aggregate) +// OMP5-NEXT: #pragma omp target defaultmap(none: aggregate) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(default: aggregate) +// OMP5-NEXT: #pragma omp target defaultmap(default: aggregate) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(alloc: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(alloc: pointer) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(to: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(to: pointer) foo(); -// CHECK-NEXT: foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(from: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(from: pointer) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(tofrom: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: pointer) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(firstprivate: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(firstprivate: pointer) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(none: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(none: pointer) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(default: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(default: pointer) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(to: scalar) defaultmap(tofrom: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(to: scalar) defaultmap(tofrom: pointer) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(from: pointer) defaultmap(none: aggregate) +// OMP5-NEXT: #pragma omp target defaultmap(from: pointer) defaultmap(none: aggregate) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(default: aggregate) defaultmap(alloc: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(default: aggregate) defaultmap(alloc: scalar) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(alloc: aggregate) defaultmap(firstprivate: scalar) defaultmap(tofrom: pointer) +// OMP5-NEXT: #pragma omp target defaultmap(alloc: aggregate) defaultmap(firstprivate: scalar) defaultmap(tofrom: pointer) + foo(); +// OMP5-NEXT: foo(); + +#pragma omp target defaultmap(tofrom: aggregate) defaultmap(to: pointer) defaultmap(alloc: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(tofrom: aggregate) defaultmap(to: pointer) defaultmap(alloc: scalar) + foo(); +// OMP5-NEXT: foo(); + + int *g; +// OMP5-NEXT: int *g; + +#pragma omp target is_device_ptr(g) defaultmap(none: pointer) +// OMP5-NEXT: #pragma omp target is_device_ptr(g) defaultmap(none: pointer) + g++; +// OMP5-NEXT: g++; + +#pragma omp target private(g) defaultmap(none: pointer) +// OMP5-NEXT: #pragma omp target private(g) defaultmap(none: pointer) + g++; +// OMP5-NEXT: g++; + +#pragma omp target firstprivate(g) defaultmap(none: pointer) +// OMP5-NEXT: #pragma omp target firstprivate(g) defaultmap(none: pointer) + g++; +// OMP5-NEXT: g++; + +#pragma omp target defaultmap(none: scalar) map(to: i) +// OMP5-NEXT: #pragma omp target defaultmap(none: scalar) map(to: i) + i++; +// OMP5-NEXT: i++; + +#pragma omp target defaultmap(none: aggregate) map(to: a) +// OMP5-NEXT: #pragma omp target defaultmap(none: aggregate) map(to: a) + a[3]++; +// OMP5-NEXT: a[3]++; +#pragma omp target defaultmap(none: scalar) +// OMP5-NEXT: #pragma omp target defaultmap(none: scalar) + bar(); +// OMP5-NEXT: bar(); return tmain(argc, &argc) + tmain(argv[0][0], argv[0]); } +#endif //OMP5 #endif diff --git a/clang/test/OpenMP/target_defaultmap_codegen.cpp b/clang/test/OpenMP/target_defaultmap_codegen.cpp new file mode 100644 --- /dev/null +++ b/clang/test/OpenMP/target_defaultmap_codegen.cpp @@ -0,0 +1,1471 @@ +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +#ifdef CK1 + +///==========================================================================/// +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 +// RUN: %clang_cc1 -DCK1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK1 + +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// SIMD-ONLY10-NOT: {{__kmpc|__tgt}} + +// CK1-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double_complex{{.*}}_l44.region_id = weak constant i8 0 + +// CK1-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] +// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 +// CK1-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544] + +// CK1-LABEL: implicit_maps_double_complex{{.*}}( +void implicit_maps_double_complex (int a){ + double _Complex dc = (double)a; + + // CK1-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK1-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK1-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK1-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK1-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK1-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }** + // CK1-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }** + // CK1-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]] + // CK1-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]] + + // CK1: call void [[KERNEL:@.+]]({ double, double }* [[PTR]]) + #pragma omp target defaultmap(alloc:scalar) + { + dc *= dc; + } +} + +// CK1: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]]) +// CK1: [[ADDR:%.+]] = alloca { double, double }*, +// CK1: store { double, double }* [[ARG]], { double, double }** [[ADDR]], +// CK1: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]], +// CK1: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 +// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 +// RUN: %clang_cc1 -DCK2 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 +// RUN: %clang_cc1 -DCK2 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK2 + +// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK2 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK2 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK2 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// SIMD-ONLY10-NOT: {{__kmpc|__tgt}} +#ifdef CK2 + +// CK2-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double_complex{{.*}}_l94.region_id = weak constant i8 0 + +// CK2-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] +// Map types: OMP_MAP_TO | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 545 +// CK2-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 545] + +// CK2-LABEL: implicit_maps_double_complex{{.*}}( +void implicit_maps_double_complex (int a){ + double _Complex dc = (double)a; + + // CK2-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK2-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK2-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK2-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK2-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK2-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }** + // CK2-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }** + // CK2-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]] + // CK2-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]] + + // CK2: call void [[KERNEL:@.+]]({ double, double }* [[PTR]]) + #pragma omp target defaultmap(to:scalar) + { + dc *= dc; + } +} + +// CK2: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]]) +// CK2: [[ADDR:%.+]] = alloca { double, double }*, +// CK2: store { double, double }* [[ARG]], { double, double }** [[ADDR]], +// CK2: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]], +// CK2: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 +// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 +// RUN: %clang_cc1 -DCK3 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 +// RUN: %clang_cc1 -DCK3 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK3 + +// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK3 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK3 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// RUN: %clang_cc1 -DCK3 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY10 %s +// SIMD-ONLY10-NOT: {{__kmpc|__tgt}} +#ifdef CK3 + +// CK3-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double_complex{{.*}}_l144.region_id = weak constant i8 0 + +// CK3-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] +// Map types: OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 546 +// CK3-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 546] + +// CK3-LABEL: implicit_maps_double_complex{{.*}}( +void implicit_maps_double_complex (int a){ + double _Complex dc = (double)a; + + // CK3-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK3-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK3-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK3-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK3-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK3-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to { double, double }** + // CK3-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to { double, double }** + // CK3-DAG: store { double, double }* [[PTR:%[^,]+]], { double, double }** [[CBP1]] + // CK3-DAG: store { double, double }* [[PTR]], { double, double }** [[CP1]] + + // CK3: call void [[KERNEL:@.+]]({ double, double }* [[PTR]]) + #pragma omp target defaultmap(from:scalar) + { + dc *= dc; + } +} + +// CK3: define internal void [[KERNEL]]({ double, double }* {{.*}}[[ARG:%.+]]) +// CK3: [[ADDR:%.+]] = alloca { double, double }*, +// CK3: store { double, double }* [[ARG]], { double, double }** [[ADDR]], +// CK3: [[REF:%.+]] = load { double, double }*, { double, double }** [[ADDR]], +// CK3: {{.+}} = getelementptr inbounds { double, double }, { double, double }* [[REF]], i32 0, i32 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 +// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-64 +// RUN: %clang_cc1 -DCK4 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 +// RUN: %clang_cc1 -DCK4 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK4 --check-prefix CK4-32 + +// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK4 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK4 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK4 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// SIMD-ONLY6-NOT: {{__kmpc|__tgt}} +#ifdef CK4 + +// For a 32-bit targets, the value doesn't fit the size of the pointer, +// therefore it is passed by reference with a map 'to' specification. + +// CK4-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double{{.*}}_l209.region_id = weak constant i8 0 + +// CK4-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] +// Map types: OMP_MAP_PRIVATE_VAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK4-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] +// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 673 +// CK4-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 673] + +// CK4-LABEL: implicit_maps_double{{.*}}( +void implicit_maps_double (int a){ + double d = (double)a; + + // CK4-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK4-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + + // CK4-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK4-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK4-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK4-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK4-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK4-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double* + // CK4-64-64-DAG: store double {{.+}}, double* [[CADDR]], + + // CK4-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double** + // CK4-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double** + // CK4-32-DAG: store double* [[DECL:%[^,]+]], double** [[CBP1]] + // CK4-32-DAG: store double* [[DECL]], double** [[CP1]] + + // CK4-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + // CK4-32: call void [[KERNEL:@.+]](double* [[DECL]]) + #pragma omp target defaultmap(firstprivate:scalar) + { + d += 1.0; + } +} + +// CK4-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK4-64: [[ADDR:%.+]] = alloca i[[sz]], +// CK4-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK4-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double* +// CK4-64: {{.+}} = load double, double* [[CADDR]], + +// CK4-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]]) +// CK4-32: [[ADDR:%.+]] = alloca double*, +// CK4-32: store double* [[ARG]], double** [[ADDR]], +// CK4-32: [[REF:%.+]] = load double*, double** [[ADDR]], +// CK4-32: {{.+}} = load double, double* [[REF]], + +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 +// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 +// RUN: %clang_cc1 -DCK5 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 +// RUN: %clang_cc1 -DCK5 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK5 + +// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK5 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK5 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK5 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK5 + +// CK5-LABEL: @.__omp_offloading_{{.*}}implicit_maps_array{{.*}}_l266.region_id = weak constant i8 0 + +// CK5-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] +// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 +// CK5-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544] + +// CK5-LABEL: implicit_maps_array{{.*}}( +void implicit_maps_array (int a){ + double darr[2] = {(double)a, (double)a}; + + // CK5-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK5-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK5-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK5-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK5-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK5-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]** + // CK5-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]** + // CK5-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]] + // CK5-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]] + + // CK5: call void [[KERNEL:@.+]]([2 x double]* [[DECL]]) + #pragma omp target defaultmap(alloc: aggregate) + { + darr[0] += 1.0; + darr[1] += 1.0; + } +} + +// CK5: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]]) +// CK5: [[ADDR:%.+]] = alloca [2 x double]*, +// CK5: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]], +// CK5: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]], +// CK5: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i{{64|32}} 0, i{{64|32}} 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 +// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 +// RUN: %clang_cc1 -DCK6 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 +// RUN: %clang_cc1 -DCK6 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK6 + +// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK6 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK6 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK6 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK6 + +// CK6-LABEL: @.__omp_offloading_{{.*}}implicit_maps_array{{.*}}_l317.region_id = weak constant i8 0 + +// CK6-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] +// Map types: OMP_MAP_TO | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 545 +// CK6-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 545] + +// CK6-LABEL: implicit_maps_array{{.*}}( +void implicit_maps_array (int a){ + double darr[2] = {(double)a, (double)a}; + + // CK6-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK6-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK6-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK6-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK6-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK6-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]** + // CK6-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]** + // CK6-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]] + // CK6-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]] + + // CK6: call void [[KERNEL:@.+]]([2 x double]* [[DECL]]) + #pragma omp target defaultmap(to: aggregate) + { + darr[0] += 1.0; + darr[1] += 1.0; + } +} + +// CK6: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]]) +// CK6: [[ADDR:%.+]] = alloca [2 x double]*, +// CK6: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]], +// CK6: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]], +// CK6: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i{{64|32}} 0, i{{64|32}} 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 +// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 +// RUN: %clang_cc1 -DCK7 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 +// RUN: %clang_cc1 -DCK7 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK7 + +// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK7 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK7 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK7 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK7 + +// CK7-LABEL: @.__omp_offloading_{{.*}}implicit_maps_array{{.*}}_l368.region_id = weak constant i8 0 + +// CK7-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] +// Map types: OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 546 +// CK7-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 546] + +// CK7-LABEL: implicit_maps_array{{.*}}( +void implicit_maps_array (int a){ + double darr[2] = {(double)a, (double)a}; + + // CK7-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK7-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK7-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK7-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK7-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK7-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]** + // CK7-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]** + // CK7-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]] + // CK7-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]] + + // CK7: call void [[KERNEL:@.+]]([2 x double]* [[DECL]]) + #pragma omp target defaultmap(from: aggregate) + { + darr[0] += 1.0; + darr[1] += 1.0; + } +} + +// CK7: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]]) +// CK7: [[ADDR:%.+]] = alloca [2 x double]*, +// CK7: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]], +// CK7: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]], +// CK7: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i{{64|32}} 0, i{{64|32}} 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 +// RUN: %clang_cc1 -DCK8 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK8 + +// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK8 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK8 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK8 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK8 + +// CK8-LABEL: @.__omp_offloading_{{.*}}implicit_maps_array{{.*}}_l419.region_id = weak constant i8 0 + +// CK8-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 16] +// Map types: OMP_MAP_TO | OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 +// CK8-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547] + +// CK8-LABEL: implicit_maps_array{{.*}}( +void implicit_maps_array (int a){ + double darr[2] = {(double)a, (double)a}; + + // CK8-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK8-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK8-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK8-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK8-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK8-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [2 x double]** + // CK8-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [2 x double]** + // CK8-DAG: store [2 x double]* [[DECL:%[^,]+]], [2 x double]** [[CBP1]] + // CK8-DAG: store [2 x double]* [[DECL]], [2 x double]** [[CP1]] + + // CK8: call void [[KERNEL:@.+]]([2 x double]* [[DECL]]) + #pragma omp target defaultmap(tofrom: aggregate) + { + darr[0] += 1.0; + darr[1] += 1.0; + } +} + +// CK8: define internal void [[KERNEL]]([2 x double]* {{.+}}[[ARG:%.+]]) +// CK8: [[ADDR:%.+]] = alloca [2 x double]*, +// CK8: store [2 x double]* [[ARG]], [2 x double]** [[ADDR]], +// CK8: [[REF:%.+]] = load [2 x double]*, [2 x double]** [[ADDR]], +// CK8: {{.+}} = getelementptr inbounds [2 x double], [2 x double]* [[REF]], i{{64|32}} 0, i{{64|32}} 0 +#endif + +///==========================================================================/// +// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 --check-prefix CK9-64 +// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 --check-prefix CK9-64 +// RUN: %clang_cc1 -DCK9 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 --check-prefix CK9-32 +// RUN: %clang_cc1 -DCK9 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK9 --check-prefix CK9-32 + +// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s +// RUN: %clang_cc1 -DCK9 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s +// RUN: %clang_cc1 -DCK9 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s +// RUN: %clang_cc1 -DCK9 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY26 %s +// SIMD-ONLY26-NOT: {{__kmpc|__tgt}} + +#ifdef CK9 + + +// CK9-LABEL: @.__omp_offloading_{{.*}}zero_size_section_and_private_maps{{.*}}_l{{[0-9]+}}.region_id = weak constant i8 0 +// CK9: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 40] +// CK9: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 673] + + +// CK9-LABEL: zero_size_section_and_private_maps{{.*}}( +void zero_size_section_and_private_maps (int ii){ + int pvtArr[10]; + + // Region 09 + // CK9-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}) + // CK9-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK9-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK9-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK9-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK9-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to [10 x i32]** + // CK9-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to [10 x i32]** + // CK9-DAG: store [10 x i32]* [[VAR0:%.+]], [10 x i32]** [[CBP0]] + // CK9-DAG: store [10 x i32]* [[VAR0]], [10 x i32]** [[CP0]] + + // CK9: call void [[CALL09:@.+]]([10 x i32]* {{[^,]+}}) + #pragma omp target defaultmap(firstprivate:aggregate) + { + pvtArr[5]++; + } + +} + + +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 +// RUN: %clang_cc1 -DCK10 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK10 + +// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK10 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK10 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK10 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK10 + + +// CK10-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l523.region_id = weak constant i8 0 + +// CK10: [[SIZE:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 +// CK10: [[MTYPE:@.+]] = private {{.*}}constant [1 x i64] [i64 544] + +// CK10-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (){ + int *pa; + + // CK10-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE]]{{.+}}) + // CK10-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK10-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK10-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK10-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK10-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** + // CK10-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** + // CK10-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]] + // CK10-DAG: store i32** [[VAR0]], i32*** [[CP0]] + + // CK10: call void [[CALL:@.+]](i32** {{[^,]+}}) + #pragma omp target defaultmap(alloc: pointer) + { + pa[50]++; + } +} + + // CK10: define {{.+}}[[CALL]] +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 +// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 +// RUN: %clang_cc1 -DCK11 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 +// RUN: %clang_cc1 -DCK11 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK11 + +// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK11 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK11 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK11 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK11 + + +// CK11-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l571.region_id = weak constant i8 0 + +// CK11: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// Map types: OMP_MAP_TO | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 545 +// CK11: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 545] + +// CK11-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (){ + int *pa; + + // CK11-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}) + // CK11-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK11-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK11-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK11-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK11-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** + // CK11-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** + // CK11-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]] + // CK11-DAG: store i32** [[VAR0]], i32*** [[CP0]] + + // CK11: call void [[CALL09:@.+]](i32** {{[^,]+}}) + #pragma omp target defaultmap(to: pointer) + { + pa[50]++; + } +} + + // CK11: define {{.+}}[[CALL09]] +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 +// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 +// RUN: %clang_cc1 -DCK12 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 +// RUN: %clang_cc1 -DCK12 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK12 + +// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK12 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK12 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK12 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK12 + + +// CK12-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l619.region_id = weak constant i8 0 + +// CK12: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// Map types: OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 546 +// CK12: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 546] + +// CK12-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (){ + int *pa; + + // CK12-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}) + // CK12-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK12-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK12-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK12-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK12-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** + // CK12-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** + // CK12-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]] + // CK12-DAG: store i32** [[VAR0]], i32*** [[CP0]] + + // CK12: call void [[CALL09:@.+]](i32** {{[^,]+}}) + #pragma omp target defaultmap(from: pointer) + { + pa[50]++; + } +} + + // CK12: define {{.+}}[[CALL09]] +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 +// RUN: %clang_cc1 -DCK13 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK13 + +// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK13 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK13 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK13 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK13 + + +// CK13-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l667.region_id = weak constant i8 0 + +// CK13: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] [i64 {{8|4}}] +// Map types: OMP_MAP_TO | OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 +// CK13: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 547] + +// CK13-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (){ + int *pa; + + // CK13-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}) + // CK13-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK13-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK13-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK13-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK13-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32*** + // CK13-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32*** + // CK13-DAG: store i32** [[VAR0:%.+]], i32*** [[CBP0]] + // CK13-DAG: store i32** [[VAR0]], i32*** [[CP0]] + + // CK13: call void [[CALL09:@.+]](i32** {{[^,]+}}) + #pragma omp target defaultmap(tofrom: pointer) + { + pa[50]++; + } +} + + // CK13: define {{.+}}[[CALL09]] +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 +// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 +// RUN: %clang_cc1 -DCK14 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 +// RUN: %clang_cc1 -DCK14 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK14 + +// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK14 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK14 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// RUN: %clang_cc1 -DCK14 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY8 %s +// SIMD-ONLY8-NOT: {{__kmpc|__tgt}} +#ifdef CK14 + + +// CK14-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l715.region_id = weak constant i8 0 + +// CK14: [[SIZE09:@.+]] = private {{.*}}constant [1 x i64] zeroinitializer +// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 +// CK14: [[MTYPE09:@.+]] = private {{.*}}constant [1 x i64] [i64 544] + +// CK14-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (){ + int *pa; + + // CK14-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE09]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE09]]{{.+}}) + // CK14-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK14-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK14-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK14-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK14-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK14-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK14-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK14-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK14: call void [[CALL09:@.+]](i32* {{[^,]+}}) + #pragma omp target defaultmap(firstprivate: pointer) + { + pa[50]++; + } +} + + // CK14: define {{.+}}[[CALL09]] +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 +// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 +// RUN: %clang_cc1 -DCK15 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 +// RUN: %clang_cc1 -DCK15 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK15 + +// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s +// RUN: %clang_cc1 -DCK15 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s +// RUN: %clang_cc1 -DCK15 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s +// RUN: %clang_cc1 -DCK15 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY12 %s +// SIMD-ONLY12-NOT: {{__kmpc|__tgt}} +#ifdef CK15 + +// CK15-LABEL: @.__omp_offloading_{{.*}}implicit_maps_variable_length_array{{.*}}_l787.region_id = weak constant i8 0 + +// We don't have a constant map size for VLAs. +// Map types: +// - OMP_MAP_LITERAL + OMP_MAP_TARGET_PARAM + OMP_MAP_IMPLICIT = 800 (vla size) +// - OMP_MAP_LITERAL + OMP_MAP_TARGET_PARAM + OMP_MAP_IMPLICIT = 800 (vla size) +// - OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 +// CK15-DAG: [[TYPES:@.+]] = {{.+}}constant [3 x i64] [i64 800, i64 800, i64 544] + +// CK15-LABEL: implicit_maps_variable_length_array{{.*}}( +void implicit_maps_variable_length_array (int a){ + double vla[2][a]; + + // CK15-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 3, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], i64* [[SGEP:%[^,]+]], {{.+}}[[TYPES]]{{.+}}) + // CK15-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK15-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK15-DAG: [[SGEP]] = getelementptr inbounds {{.+}}[[SS:%[^,]+]], i32 0, i32 0 + + // CK15-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK15-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK15-DAG: [[S0:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 0 + // CK15-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i[[sz:64|32]]* + // CK15-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i[[sz]]* + // CK15-DAG: store i[[sz]] 2, i[[sz]]* [[CBP0]] + // CK15-DAG: store i[[sz]] 2, i[[sz]]* [[CP0]] + // CK15-DAG: store i64 {{8|4}}, i64* [[S0]], + + // CK15-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 + // CK15-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 + // CK15-DAG: [[S1:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 1 + // CK15-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz]]* + // CK15-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK15-DAG: store i[[sz]] [[VAL:%.+]], i[[sz]]* [[CBP1]] + // CK15-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK15-DAG: store i64 {{8|4}}, i64* [[S1]], + + // CK15-DAG: [[BP2:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 2 + // CK15-DAG: [[P2:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 2 + // CK15-DAG: [[S2:%.+]] = getelementptr inbounds {{.+}}[[SS]], i32 0, i32 2 + // CK15-DAG: [[CBP2:%.+]] = bitcast i8** [[BP2]] to double** + // CK15-DAG: [[CP2:%.+]] = bitcast i8** [[P2]] to double** + // CK15-DAG: store double* [[DECL:%.+]], double** [[CBP2]] + // CK15-DAG: store double* [[DECL]], double** [[CP2]] + // CK15-DAG: store i64 [[VALS2:%.+]], i64* [[S2]], + // CK15-DAG: [[VALS2]] = {{mul nuw i64 %.+, 8|sext i32 %.+ to i64}} + + // CK15: call void [[KERNEL:@.+]](i[[sz]] {{.+}}, i[[sz]] {{.+}}, double* [[DECL]]) + #pragma omp target defaultmap(alloc: aggregate) + { + vla[1][3] += 1.0; + } +} + +// CK15: define internal void [[KERNEL]](i[[sz]] [[VLA0:%.+]], i[[sz]] [[VLA1:%.+]], double* {{.*}}[[ARG:%.+]]) +// CK15: [[ADDR0:%.+]] = alloca i[[sz]], +// CK15: [[ADDR1:%.+]] = alloca i[[sz]], +// CK15: [[ADDR2:%.+]] = alloca double*, +// CK15: store i[[sz]] [[VLA0]], i[[sz]]* [[ADDR0]], +// CK15: store i[[sz]] [[VLA1]], i[[sz]]* [[ADDR1]], +// CK15: store double* [[ARG]], double** [[ADDR2]], +// CK15: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR0]], +// CK15: {{.+}} = load i[[sz]], i[[sz]]* [[ADDR1]], +// CK15: [[REF:%.+]] = load double*, double** [[ADDR2]], +// CK15: {{.+}} = getelementptr inbounds double, double* [[REF]], i[[sz]] %{{.+}} +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 +// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 +// RUN: %clang_cc1 -DCK16 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 +// RUN: %clang_cc1 -DCK16 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK16 + +// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK16 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK16 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK16 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// SIMD-ONLY16-NOT: {{__kmpc|__tgt}} +#ifdef CK16 + +// CK16-DAG: [[ST:%.+]] = type { i32, double } +// CK16-LABEL: @.__omp_offloading_{{.*}}implicit_maps_struct{{.*}}_l849.region_id = weak constant i8 0 +// CK16-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 {{16|12}}] +// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 +// CK16-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544] + +class SSS { +public: + int a; + double b; +}; + +// CK16-LABEL: implicit_maps_struct{{.*}}( +void implicit_maps_struct (int a){ + SSS s = {a, (double)a}; + + // CK16-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK16-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK16-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK16-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK16-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK16-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK16-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]** + // CK16-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]] + // CK16-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]] + + // CK16: call void [[KERNEL:@.+]]([[ST]]* [[DECL]]) + #pragma omp target defaultmap(alloc: aggregate) + { + s.a += 1; + s.b += 1.0; + } +} + +// CK16: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]]) +// CK16: [[ADDR:%.+]] = alloca [[ST]]*, +// CK16: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]], +// CK16: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]], +// CK16: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 +// RUN: %clang_cc1 -DCK17 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK17 + +// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK17 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK17 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK17 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// SIMD-ONLY16-NOT: {{__kmpc|__tgt}} +#ifdef CK17 + +// CK17-DAG: [[ST:%.+]] = type { i32, double } +// CK17-LABEL: @.__omp_offloading_{{.*}}implicit_maps_struct{{.*}}_l906.region_id = weak constant i8 0 +// CK17-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 {{16|12}}] +// Map types: OMP_MAP_TO | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 545 +// CK17-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 545] + +class SSS { +public: + int a; + double b; +}; + +// CK17-LABEL: implicit_maps_struct{{.*}}( +void implicit_maps_struct (int a){ + SSS s = {a, (double)a}; + + // CK17-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK17-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK17-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK17-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK17-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK17-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK17-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]** + // CK17-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]] + // CK17-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]] + + // CK17: call void [[KERNEL:@.+]]([[ST]]* [[DECL]]) + #pragma omp target defaultmap(to: aggregate) + { + s.a += 1; + s.b += 1.0; + } +} + +// CK17: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]]) +// CK17: [[ADDR:%.+]] = alloca [[ST]]*, +// CK17: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]], +// CK17: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]], +// CK17: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 +// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 +// RUN: %clang_cc1 -DCK18 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 +// RUN: %clang_cc1 -DCK18 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK18 + +// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK18 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK18 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK18 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// SIMD-ONLY16-NOT: {{__kmpc|__tgt}} +#ifdef CK18 + +// CK18-DAG: [[ST:%.+]] = type { i32, double } +// CK18-LABEL: @.__omp_offloading_{{.*}}implicit_maps_struct{{.*}}_l963.region_id = weak constant i8 0 +// CK18-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 {{16|12}}] +// Map types: OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 546 +// CK18-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 546] + +class SSS { +public: + int a; + double b; +}; + +// CK18-LABEL: implicit_maps_struct{{.*}}( +void implicit_maps_struct (int a){ + SSS s = {a, (double)a}; + + // CK18-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK18-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK18-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK18-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK18-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK18-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK18-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]** + // CK18-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]] + // CK18-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]] + + // CK18: call void [[KERNEL:@.+]]([[ST]]* [[DECL]]) + #pragma omp target defaultmap(from: aggregate) + { + s.a += 1; + s.b += 1.0; + } +} + +// CK18: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]]) +// CK18: [[ADDR:%.+]] = alloca [[ST]]*, +// CK18: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]], +// CK18: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]], +// CK18: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK19 +// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK19 +// RUN: %clang_cc1 -DCK19 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK19 +// RUN: %clang_cc1 -DCK19 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK19 + +// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK19 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK19 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// SIMD-ONLY16-NOT: {{__kmpc|__tgt}} +#ifdef CK19 + +// CK19-DAG: [[ST:%.+]] = type { i32, double } +// CK19-LABEL: @.__omp_offloading_{{.*}}implicit_maps_struct{{.*}}_l1020.region_id = weak constant i8 0 +// CK19-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 {{16|12}}] +// Map types: OMP_MAP_TO | OMP_MAP_FROM | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 +// CK19-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547] + +class SSS { +public: + int a; + double b; +}; + +// CK19-LABEL: implicit_maps_struct{{.*}}( +void implicit_maps_struct (int a){ + SSS s = {a, (double)a}; + + // CK19-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK19-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK19-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK19-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK19-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK19-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK19-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]** + // CK19-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]] + // CK19-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]] + + // CK19: call void [[KERNEL:@.+]]([[ST]]* [[DECL]]) + #pragma omp target defaultmap(tofrom: aggregate) + { + s.a += 1; + s.b += 1.0; + } +} + +// CK19: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]]) +// CK19: [[ADDR:%.+]] = alloca [[ST]]*, +// CK19: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]], +// CK19: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]], +// CK19: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 +// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-64 +// RUN: %clang_cc1 -DCK20 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 +// RUN: %clang_cc1 -DCK20 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK20 --check-prefix CK20-32 + +// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK20 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// RUN: %clang_cc1 -DCK20 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY6 %s +// SIMD-ONLY6-NOT: {{__kmpc|__tgt}} +#ifdef CK20 + +// For a 32-bit targets, the value doesn't fit the size of the pointer, +// therefore it is passed by reference with a map 'to' specification. + +// CK20-LABEL: @.__omp_offloading_{{.*}}implicit_maps_double{{.*}}_l1086.region_id = weak constant i8 0 + +// CK20-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 8] +// Map types: OMP_MAP_LITERAL | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 800 +// CK20-64-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 800] +// Map types: OMP_MAP_TO | OMP_MAP_PRIVATE | OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 673 +// CK20-32-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 673] + +// CK20-LABEL: implicit_maps_double{{.*}}( +void implicit_maps_double (int a){ + double d = (double)a; + + // CK20-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK20-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK20-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK20-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK20-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + + // CK20-64-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i[[sz:64|32]]* + // CK20-64-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i[[sz]]* + // CK20-64-DAG: store i[[sz]] [[VAL:%[^,]+]], i[[sz]]* [[CBP1]] + // CK20-64-DAG: store i[[sz]] [[VAL]], i[[sz]]* [[CP1]] + // CK20-64-DAG: [[VAL]] = load i[[sz]], i[[sz]]* [[ADDR:%.+]], + // CK20-64-64-DAG: [[CADDR:%.+]] = bitcast i[[sz]]* [[ADDR]] to double* + // CK20-64-64-DAG: store double {{.+}}, double* [[CADDR]], + + // CK20-32-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double** + // CK20-32-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double** + // CK20-32-DAG: store double* [[DECL:%[^,]+]], double** [[CBP1]] + // CK20-32-DAG: store double* [[DECL]], double** [[CP1]] + + // CK20-64: call void [[KERNEL:@.+]](i[[sz]] [[VAL]]) + // CK20-32: call void [[KERNEL:@.+]](double* [[DECL]]) + #pragma omp target defaultmap(default: scalar) + { + d += 1.0; + } +} + +// CK20-64: define internal void [[KERNEL]](i[[sz]] [[ARG:%.+]]) +// CK20-64: [[ADDR:%.+]] = alloca i[[sz]], +// CK20-64: store i[[sz]] [[ARG]], i[[sz]]* [[ADDR]], +// CK20-64: [[CADDR:%.+]] = bitcast i64* [[ADDR]] to double* +// CK20-64: {{.+}} = load double, double* [[CADDR]], + +// CK20-32: define internal void [[KERNEL]](double* {{.+}}[[ARG:%.+]]) +// CK20-32: [[ADDR:%.+]] = alloca double*, +// CK20-32: store double* [[ARG]], double** [[ADDR]], +// CK20-32: [[REF:%.+]] = load double*, double** [[ADDR]], +// CK20-32: {{.+}} = load double, double* [[REF]], + +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK21 +// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK21 +// RUN: %clang_cc1 -DCK21 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK21 +// RUN: %clang_cc1 -DCK21 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK21 + +// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK21 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK21 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// RUN: %clang_cc1 -DCK21 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY16 %s +// SIMD-ONLY16-NOT: {{__kmpc|__tgt}} +#ifdef CK21 + +// CK21-DAG: [[ST:%.+]] = type { i32, double } +// CK21-LABEL: @.__omp_offloading_{{.*}}implicit_maps_struct{{.*}}_l1149.region_id = weak constant i8 0 +// CK21-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] [i64 {{16|12}}] +// Map types: OMP_MAP_TO + OMP_MAP_FROM + OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 547 +// CK21-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 547] + +class SSS { +public: + int a; + double b; +}; + +// CK21-LABEL: implicit_maps_struct{{.*}}( +void implicit_maps_struct (int a){ + SSS s = {a, (double)a}; + + // CK21-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK21-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK21-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK21-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK21-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK21-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to [[ST]]** + // CK21-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to [[ST]]** + // CK21-DAG: store [[ST]]* [[DECL:%.+]], [[ST]]** [[CBP1]] + // CK21-DAG: store [[ST]]* [[DECL]], [[ST]]** [[CP1]] + + // CK21: call void [[KERNEL:@.+]]([[ST]]* [[DECL]]) + #pragma omp target defaultmap(default: aggregate) + { + s.a += 1; + s.b += 1.0; + } +} + +// CK21: define internal void [[KERNEL]]([[ST]]* {{.+}}[[ARG:%.+]]) +// CK21: [[ADDR:%.+]] = alloca [[ST]]*, +// CK21: store [[ST]]* [[ARG]], [[ST]]** [[ADDR]], +// CK21: [[REF:%.+]] = load [[ST]]*, [[ST]]** [[ADDR]], +// CK21: {{.+}} = getelementptr inbounds [[ST]], [[ST]]* [[REF]], i32 0, i32 0 +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 +// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 +// RUN: %clang_cc1 -DCK22 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 +// RUN: %clang_cc1 -DCK22 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK22 + +// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s +// RUN: %clang_cc1 -DCK22 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s +// RUN: %clang_cc1 -DCK22 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s +// RUN: %clang_cc1 -DCK22 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY9 %s +// SIMD-ONLY9-NOT: {{__kmpc|__tgt}} +#ifdef CK22 + +// CK22-LABEL: @.__omp_offloading_{{.*}}implicit_maps_pointer{{.*}}_l1200.region_id = weak constant i8 0 + +// CK22-DAG: [[SIZES:@.+]] = {{.+}}constant [1 x i64] zeroinitializer +// Map types: OMP_MAP_TARGET_PARAM | OMP_MAP_IMPLICIT = 544 +// CK22-DAG: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 544] + +// CK22-LABEL: implicit_maps_pointer{{.*}}( +void implicit_maps_pointer (){ + double *ddyn; + + // CK22-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK22-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK22-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK22-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK22-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK22-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double** + // CK22-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double** + // CK22-DAG: store double* [[PTR:%[^,]+]], double** [[CBP1]] + // CK22-DAG: store double* [[PTR]], double** [[CP1]] + + // CK22: call void [[KERNEL:@.+]](double* [[PTR]]) + #pragma omp target defaultmap(default: pointer) + { + ddyn[0] += 1.0; + ddyn[1] += 1.0; + } +} + +// CK22: define internal void [[KERNEL]](double* {{.*}}[[ARG:%.+]]) +// CK22: [[ADDR:%.+]] = alloca double*, +// CK22: store double* [[ARG]], double** [[ADDR]], +// CK22: [[REF:%.+]] = load double*, double** [[ADDR]], +// CK22: {{.+}} = getelementptr inbounds double, double* [[REF]], i{{64|32}} 0 + +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK23 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-64 +// RUN: %clang_cc1 -DCK23 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-64 +// RUN: %clang_cc1 -DCK23 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-32 +// RUN: %clang_cc1 -DCK23 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK23 --check-prefix CK23-32 + +// RUN: %clang_cc1 -DCK23 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK23 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK23 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -DCK23 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +#ifdef CK23 + +double *g; + +// CK23: @g = global double* +// CK23: [[SIZES00:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} {{8|4}}] +// CK23: [[TYPES00:@.+]] = {{.+}}constant [1 x i64] [i64 288] + +// CK23: [[SIZES01:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] {{8|4}}] +// CK23: [[TYPES01:@.+]] = {{.+}}constant [1 x i64] [i64 288] + +// CK23: [[SIZES02:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] {{8|4}}] +// CK23: [[TYPES02:@.+]] = {{.+}}constant [1 x i64] [i64 288] + +// CK23: [[SIZES03:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] {{8|4}}] +// CK23: [[TYPES03:@.+]] = {{.+}}constant [1 x i64] [i64 288] + +// CK23: [[SIZES04:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] {{8|4}}] +// CK23: [[TYPES04:@.+]] = {{.+}}constant [1 x i64] [i64 288] + +// CK23: [[SIZES05:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] {{8|4}}] +// CK23: [[TYPES05:@.+]] = {{.+}}constant [1 x i64] [i64 288] + +// CK23: [[SIZES06:@.+]] = {{.+}}constant [2 x i[[sz]]] [i[[sz]] {{8|4}}, i[[sz]] {{8|4}}] +// CK23: [[TYPES06:@.+]] = {{.+}}constant [2 x i64] [i64 288, i64 288] + +// CK23-LABEL: @_Z3foo{{.*}}( +template +void foo(float *&lr, T *&tr) { + float *l; + T *t; + + // CK23-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES00]]{{.+}}, {{.+}}[[TYPES00]]{{.+}}) + // CK23-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK23-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK23-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to double** + // CK23-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to double** + // CK23-DAG: store double* [[VAL:%.+]], double** [[CBP1]] + // CK23-DAG: store double* [[VAL]], double** [[CP1]] + // CK23-DAG: [[VAL]] = load double*, double** [[ADDR:@g]], + + // CK23: call void [[KERNEL:@.+]](double* [[VAL]]) + #pragma omp target is_device_ptr(g) defaultmap(none:pointer) + { + ++g; + } + + // CK23-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES01]]{{.+}}, {{.+}}[[TYPES01]]{{.+}}) + // CK23-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK23-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK23-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float** + // CK23-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float** + // CK23-DAG: store float* [[VAL:%.+]], float** [[CBP1]] + // CK23-DAG: store float* [[VAL]], float** [[CP1]] + // CK23-DAG: [[VAL]] = load float*, float** [[ADDR:%.+]], + + // CK23: call void [[KERNEL:@.+]](float* [[VAL]]) + #pragma omp target is_device_ptr(l) defaultmap(none:pointer) + { + ++l; + } + + // CK23-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES02]]{{.+}}, {{.+}}[[TYPES02]]{{.+}}) + // CK23-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK23-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK23-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK23-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK23-DAG: store i32* [[VAL:%.+]], i32** [[CBP1]] + // CK23-DAG: store i32* [[VAL]], i32** [[CP1]] + // CK23-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]], + + // CK23: call void [[KERNEL:@.+]](i32* [[VAL]]) + #pragma omp target is_device_ptr(t) defaultmap(none:pointer) + { + ++t; + } + + // CK23-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES03]]{{.+}}, {{.+}}[[TYPES03]]{{.+}}) + // CK23-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK23-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK23-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to float** + // CK23-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to float** + // CK23-DAG: store float* [[VAL:%.+]], float** [[CBP1]] + // CK23-DAG: store float* [[VAL]], float** [[CP1]] + // CK23-DAG: [[VAL]] = load float*, float** [[ADDR:%.+]], + // CK23-DAG: [[ADDR]] = load float**, float*** [[ADDR2:%.+]], + + // CK23: call void [[KERNEL:@.+]](float* [[VAL]]) + #pragma omp target is_device_ptr(lr) defaultmap(none:pointer) + { + ++lr; + } + + // CK23-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES04]]{{.+}}, {{.+}}[[TYPES04]]{{.+}}) + // CK23-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK23-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK23-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK23-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK23-DAG: store i32* [[VAL:%.+]], i32** [[CBP1]] + // CK23-DAG: store i32* [[VAL]], i32** [[CP1]] + // CK23-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]], + // CK23-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]], + + // CK23: call void [[KERNEL:@.+]](i32* [[VAL]]) + #pragma omp target is_device_ptr(tr) defaultmap(none:pointer) + { + ++tr; + } + + // CK23-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES05]]{{.+}}, {{.+}}[[TYPES05]]{{.+}}) + // CK23-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK23-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK23-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK23-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK23-DAG: store i32* [[VAL:%.+]], i32** [[CBP1]] + // CK23-DAG: store i32* [[VAL]], i32** [[CP1]] + // CK23-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]], + // CK23-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]], + + // CK23: call void [[KERNEL:@.+]](i32* [[VAL]]) + #pragma omp target is_device_ptr(tr,lr) defaultmap(none:pointer) + { + ++tr; + } + + // CK23-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 2, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES06]]{{.+}}, {{.+}}[[TYPES06]]{{.+}}) + // CK23-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CK23-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CK23-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CK23-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to i32** + // CK23-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to i32** + // CK23-DAG: store i32* [[VAL:%.+]], i32** [[CBP1]] + // CK23-DAG: store i32* [[VAL]], i32** [[CP1]] + // CK23-DAG: [[VAL]] = load i32*, i32** [[ADDR:%.+]], + // CK23-DAG: [[ADDR]] = load i32**, i32*** [[ADDR2:%.+]], + + // CK23-DAG: [[_BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 1 + // CK23-DAG: [[_P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 1 + // CK23-DAG: [[_CBP1:%.+]] = bitcast i8** [[_BP1]] to float** + // CK23-DAG: [[_CP1:%.+]] = bitcast i8** [[_P1]] to float** + // CK23-DAG: store float* [[_VAL:%.+]], float** [[_CBP1]] + // CK23-DAG: store float* [[_VAL]], float** [[_CP1]] + // CK23-DAG: [[_VAL]] = load float*, float** [[_ADDR:%.+]], + // CK23-DAG: [[_ADDR]] = load float**, float*** [[_ADDR2:%.+]], + + // CK23: call void [[KERNEL:@.+]](i32* [[VAL]], float* [[_VAL]]) + #pragma omp target is_device_ptr(tr,lr) defaultmap(none:pointer) + { + ++tr,++lr; + } +} + +void bar(float *&a, int *&b) { + foo(a,b); +} + +#endif +///==========================================================================/// +// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 +// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-64 +// RUN: %clang_cc1 -DCK24 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 +// RUN: %clang_cc1 -DCK24 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s --check-prefix CK24 --check-prefix CK24-32 + +// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK24 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK24 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// RUN: %clang_cc1 -DCK24 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY18 %s +// SIMD-ONLY18-NOT: {{__kmpc|__tgt}} +#ifdef CK24 + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1443.region_id = weak constant i8 0 +// CK24: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4] +// CK24: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i64] [i64 1059] + +// CK24-LABEL: @.__omp_offloading_{{.*}}explicit_maps_single{{.*}}_l1462.region_id = weak constant i8 0 +// CK24: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] [i[[Z:64|32]] 4] +// CK24: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i64] [i64 1063] + +// CK24-LABEL: explicit_maps_single{{.*}}( +void explicit_maps_single (int ii){ + // Map of a scalar. + int a = ii; + + // Close. + // Region 00 + // CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00]]{{.+}}) + // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK24-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK24-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK24: call void [[CALL00:@.+]](i32* {{[^,]+}}) + #pragma omp target map(close, tofrom: a) defaultmap(none:scalar) + { + a++; + } + + // Always Close. + // Region 01 + // CK24-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE01]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE01]]{{.+}}) + // CK24-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] + // CK24-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] + + // CK24-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, i{{.+}} 0 + // CK24-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, i{{.+}} 0 + // CK24-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32** + // CK24-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32** + // CK24-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]] + // CK24-DAG: store i32* [[VAR0]], i32** [[CP0]] + + // CK24: call void [[CALL01:@.+]](i32* {{[^,]+}}) + #pragma omp target map(always close tofrom: a) defaultmap(none:scalar) + { + a++; + } +} +// CK24: define {{.+}}[[CALL00]] +// CK24: define {{.+}}[[CALL01]] + +#endif +#endif diff --git a/clang/test/OpenMP/target_defaultmap_messages.cpp b/clang/test/OpenMP/target_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_defaultmap_messages.cpp @@ -1,6 +1,24 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized + +struct Bar { + int a; +}; + +class Baz { + public: + Bar bar; + int *p; +}; + +int *g; +int arr[50]; +Bar bar; +Baz baz; +Baz* bazPtr = &baz; void foo() { } @@ -9,50 +27,102 @@ T tmain(T argc, S **argv) { #pragma omp target defaultmap // expected-error {{expected '(' after 'defaultmap'}} foo(); - #pragma omp target defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target defaultmap ( // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target defaultmap () // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} + #pragma omp target defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target defaultmap (scalar: // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} - foo(); - #pragma omp target defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); + #pragma omp target defaultmap(tofrom:scalar) defaultmap(tofrom:scalar) // omp45-error {{directive '#pragma omp target' cannot contain more than one 'defaultmap' clause}} omp5-error {{at most one defaultmap clause for each variable-category can appear on the directive}} + foo(); + +#if OMP5 + #pragma omp target defaultmap(tofrom:scalar) defaultmap(to:scalar) // omp5-error {{at most one defaultmap clause for each variable-category can appear on the directive}} + foo(); + #pragma omp target defaultmap(alloc:pointer) defaultmap(to:scalar) defaultmap(firstprivate:pointer) // expected-error {{at most one defaultmap clause for each variable-category can appear on the directive}} + foo(); + #pragma omp target defaultmap(none:pointer) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + g++; // expected-error {{variable 'g' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:pointer) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g; // expected-error {{variable 'g' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:pointer) defaultmap(none:scalar) map(g) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:pointer) defaultmap(none:scalar) defaultmap(none:aggregate) map(g) firstprivate(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g + arr[1]; // expected-error {{variable 'arr' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + bar.a += argc; // expected-error {{variable 'bar' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + int vla[argc]; + #pragma omp target defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + vla[argc-1] += argc; // expected-error {{variable 'vla' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:aggregate) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} +#endif + return argc; } int main(int argc, char **argv) { #pragma omp target defaultmap // expected-error {{expected '(' after 'defaultmap'}} foo(); - #pragma omp target defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target defaultmap ( // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target defaultmap () // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} + #pragma omp target defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target defaultmap (scalar: // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} - foo(); - #pragma omp target defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); + #pragma omp target defaultmap(tofrom:scalar) defaultmap(tofrom:scalar) // omp45-error {{directive '#pragma omp target' cannot contain more than one 'defaultmap' clause}} omp5-error {{at most one defaultmap clause for each variable-category can appear on the directive}} + foo(); - return tmain(argc, argv); -} +#ifdef OMP5 + #pragma omp target defaultmap(tofrom:scalar) defaultmap(to:scalar) // omp5-error {{at most one defaultmap clause for each variable-category can appear on the directive}} + foo(); + #pragma omp target defaultmap(alloc:pointer) defaultmap(to:scalar) defaultmap(firstprivate:pointer) // expected-error {{at most one defaultmap clause for each variable-category can appear on the directive}} + foo(); + #pragma omp target defaultmap(none:pointer) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + g++; // expected-error {{variable 'g' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:pointer) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g; // expected-error {{variable 'g' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:pointer) defaultmap(none:scalar) map(g) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:pointer) defaultmap(none:scalar) defaultmap(none:aggregate) map(g) firstprivate(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g + arr[1]; // expected-error {{variable 'arr' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + bar.a += argc; // expected-error {{variable 'bar' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + int vla[argc]; + #pragma omp target defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + vla[argc-1] += argc; // expected-error {{variable 'vla' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + + #pragma omp target defaultmap(none:aggregate) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} +#endif + + return tmain(argc, argv); // omp5-note {{in instantiation of function template specialization 'tmain' requested here}} +} diff --git a/clang/test/OpenMP/target_parallel_defaultmap_messages.cpp b/clang/test/OpenMP/target_parallel_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_parallel_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_parallel_defaultmap_messages.cpp @@ -1,58 +1,148 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized + +struct Bar { + int a; +}; + +class Baz { + public: + Bar bar; + int *p; +}; + +int *g; +int arr[50]; +Bar bar; +Baz baz; +Baz* bazPtr = &baz; void foo() { } template T tmain(T argc, S **argv) { - #pragma omp target parallel defaultmap // expected-error {{expected '(' after 'defaultmap'}} + #pragma omp target parallel defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target parallel defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} + #pragma omp target parallel defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target parallel defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#ifdef OMP5 + #pragma omp target parallel defaultmap(tofrom:scalar) defaultmap(to:scalar) // expected-error {{at most one defaultmap clause for each variable-category can appear on the directive}} foo(); - #pragma omp target parallel defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel defaultmap(alloc:pointer) defaultmap(to:scalar) defaultmap(firstprivate:pointer) // expected-error {{at most one defaultmap clause for each variable-category can appear on the directive}} foo(); + #pragma omp target parallel defaultmap(none:pointer) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + g++; // expected-error {{variable 'g' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:pointer) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g; // expected-error {{variable 'g' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:pointer) defaultmap(none:scalar) map(g) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:pointer) defaultmap(none:scalar) defaultmap(none:aggregate) map(g) firstprivate(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g + arr[1]; // expected-error {{variable 'arr' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + bar.a += argc; // expected-error {{variable 'bar' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + int vla[argc]; + #pragma omp target parallel defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + vla[argc-1] += argc; // expected-error {{variable 'vla' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + + #pragma omp target defaultmap(none:aggregate) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + + #pragma omp parallel + #pragma omp target defaultmap(none:aggregate) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + + #pragma omp parallel + #pragma omp target defaultmap(none:aggregate) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + *baz.p += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + + #pragma omp parallel + #pragma omp target defaultmap(none:pointer) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + bazPtr->p += argc; // expected-error {{variable 'bazPtr' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + +#endif return argc; } int main(int argc, char **argv) { - #pragma omp target parallel defaultmap // expected-error {{expected '(' after 'defaultmap'}} + #pragma omp target parallel defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target parallel defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} + #pragma omp target parallel defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target parallel defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target parallel defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#ifdef OMP5 + #pragma omp target parallel defaultmap(tofrom:scalar) defaultmap(to:scalar) // expected-error {{at most one defaultmap clause for each variable-category can appear on the directive}} foo(); - #pragma omp target parallel defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel defaultmap(alloc:pointer) defaultmap(to:scalar) defaultmap(firstprivate:pointer) // expected-error {{at most one defaultmap clause for each variable-category can appear on the directive}} foo(); + #pragma omp target parallel defaultmap(none:pointer) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + g++; // expected-error {{variable 'g' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:pointer) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g; // expected-error {{variable 'g' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:pointer) defaultmap(none:scalar) map(g) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:pointer) defaultmap(none:scalar) defaultmap(none:aggregate) map(g) firstprivate(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + argc = *g + arr[1]; // expected-error {{variable 'arr' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + bar.a += argc; // expected-error {{variable 'bar' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp target parallel defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + int vla[argc]; + #pragma omp target parallel defaultmap(none:aggregate) defaultmap(none:scalar) map(argc) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + vla[argc-1] += argc; // expected-error {{variable 'vla' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} - return tmain(argc, argv); -} + #pragma omp target defaultmap(none:aggregate) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + + #pragma omp parallel + #pragma omp target defaultmap(none:aggregate) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + baz.bar.a += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + #pragma omp parallel + #pragma omp target parallel defaultmap(none:aggregate) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + *baz.p += argc; // expected-error {{variable 'baz' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} + + #pragma omp parallel + #pragma omp target defaultmap(none:pointer) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} + #pragma omp parallel + bazPtr->p += argc; // expected-error {{variable 'bazPtr' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} +#endif + + return tmain(argc, argv); // omp5-note {{in instantiation of function template specialization 'tmain' requested here}} +} diff --git a/clang/test/OpenMP/target_parallel_for_defaultmap_messages.cpp b/clang/test/OpenMP/target_parallel_for_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_parallel_for_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_parallel_for_defaultmap_messages.cpp @@ -1,6 +1,8 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized void foo() { } @@ -10,23 +12,23 @@ int i; #pragma omp target parallel for defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target parallel for defaultmap ( // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for defaultmap () // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target parallel for defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel for defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel for defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return argc; @@ -36,25 +38,24 @@ int i; #pragma omp target parallel for defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target parallel for defaultmap ( // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for defaultmap () // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target parallel for defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel for defaultmap (scalar: // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel for defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return tmain(argc, argv); } - diff --git a/clang/test/OpenMP/target_parallel_for_simd_defaultmap_messages.cpp b/clang/test/OpenMP/target_parallel_for_simd_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_parallel_for_simd_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_parallel_for_simd_defaultmap_messages.cpp @@ -1,6 +1,8 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized void foo() { } @@ -10,23 +12,23 @@ int i; #pragma omp target parallel for simd defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target parallel for simd defaultmap ( // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for simd defaultmap () // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target parallel for simd defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel for simd defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel for simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return argc; @@ -36,25 +38,24 @@ int i; #pragma omp target parallel for simd defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target parallel for simd defaultmap ( // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for simd defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target parallel for simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target parallel for simd defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel for simd defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target parallel for simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return tmain(argc, argv); } - diff --git a/clang/test/OpenMP/target_simd_defaultmap_messages.cpp b/clang/test/OpenMP/target_simd_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_simd_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_simd_defaultmap_messages.cpp @@ -1,32 +1,34 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized void foo() { } template T tmain(T argc, S **argv) { - int i, k; + int i; #pragma omp target simd defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target simd defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target simd defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target simd defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target simd defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target simd defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return argc; @@ -36,25 +38,24 @@ int i; #pragma omp target simd defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target simd defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target simd defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target simd defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target simd defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target simd defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return tmain(argc, argv); } - diff --git a/clang/test/OpenMP/target_teams_defaultmap_messages.cpp b/clang/test/OpenMP/target_teams_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_teams_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_teams_defaultmap_messages.cpp @@ -1,6 +1,8 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized void foo() { } @@ -9,23 +11,23 @@ T tmain(T argc, S **argv) { #pragma omp target teams defaultmap // expected-error {{expected '(' after 'defaultmap'}} foo(); - #pragma omp target teams defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target teams defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target teams defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target teams defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target teams defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target teams defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); #pragma omp target teams defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} foo(); - #pragma omp target teams defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target teams defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target teams defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target teams defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); return argc; @@ -34,25 +36,24 @@ int main(int argc, char **argv) { #pragma omp target teams defaultmap // expected-error {{expected '(' after 'defaultmap'}} foo(); - #pragma omp target teams defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target teams defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} + #pragma omp target teams defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target teams defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target teams defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} + #pragma omp target teams defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); #pragma omp target teams defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} foo(); - #pragma omp target teams defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} + #pragma omp target teams defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target teams defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} foo(); - #pragma omp target teams defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} + #pragma omp target teams defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} foo(); return tmain(argc, argv); } - diff --git a/clang/test/OpenMP/target_teams_distribute_defaultmap_messages.cpp b/clang/test/OpenMP/target_teams_distribute_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_teams_distribute_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_defaultmap_messages.cpp @@ -1,6 +1,8 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized void foo() { } @@ -10,23 +12,23 @@ int i; #pragma omp target teams distribute defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target teams distribute defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} +#pragma omp target teams distribute defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return argc; @@ -36,25 +38,24 @@ int i; #pragma omp target teams distribute defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target teams distribute defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} +#pragma omp target teams distribute defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return tmain(argc, argv); } - diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_defaultmap_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_defaultmap_messages.cpp @@ -1,6 +1,8 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized void foo() { } @@ -10,23 +12,23 @@ int i; #pragma omp target teams distribute parallel for defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for defaultmap ( // omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return argc; @@ -36,23 +38,23 @@ int i; #pragma omp target teams distribute parallel for defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return tmain(argc, argv); diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_defaultmap_messages.cpp b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_defaultmap_messages.cpp @@ -1,6 +1,8 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized void foo() { } @@ -10,23 +12,23 @@ int i; #pragma omp target teams distribute parallel for simd defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for simd defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for simd defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} + for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute parallel for simd defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for simd defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} - for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return argc; @@ -36,25 +38,24 @@ int i; #pragma omp target teams distribute parallel for simd defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for simd defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for simd defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for simd defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute parallel for simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return tmain(argc, argv); } - diff --git a/clang/test/OpenMP/target_teams_distribute_simd_defaultmap_messages.cpp b/clang/test/OpenMP/target_teams_distribute_simd_defaultmap_messages.cpp --- a/clang/test/OpenMP/target_teams_distribute_simd_defaultmap_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_simd_defaultmap_messages.cpp @@ -1,6 +1,8 @@ -// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 %s -verify=expected,omp5 -Wuninitialized -DOMP5 -// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s -verify=expected,omp45 -Wuninitialized void foo() { } @@ -10,23 +12,23 @@ int i; #pragma omp target teams distribute simd defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target teams distribute simd defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute simd defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} +#pragma omp target teams distribute simd defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute simd defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return argc; @@ -36,25 +38,24 @@ int i; #pragma omp target teams distribute simd defaultmap // expected-error {{expected '(' after 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap ( // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target teams distribute simd defaultmap ( // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-error {{expected ')'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap () // expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute simd defaultmap () // omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute simd defaultmap (tofrom // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute simd defaultmap (tofrom: // expected-error {{expected ')'}} expected-note {{to match this '('}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} +#pragma omp target teams distribute simd defaultmap (tofrom) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd defaultmap (tofrom scalar) // expected-warning {{missing ':' after defaultmap modifier - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom, // expected-error {{expected ')'}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} +#pragma omp target teams distribute simd defaultmap (tofrom, // expected-error {{expected ')'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (scalar: // expected-error {{expected ')'}} expected-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute simd defaultmap (scalar: // expected-error {{expected ')'}} omp5-error {{expected 'alloc', 'from', 'to', 'tofrom', 'firstprivate', 'none', 'default' in OpenMP clause 'defaultmap'}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'tofrom' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} expected-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} +#pragma omp target teams distribute simd defaultmap (tofrom, scalar // expected-error {{expected ')'}} expected-warning {{missing ':' after defaultmap modifier - ignoring}} omp5-error {{expected 'scalar', 'aggregate', 'pointer' in OpenMP clause 'defaultmap'}} expected-note {{to match this '('}} omp45-error {{expected 'scalar' in OpenMP clause 'defaultmap'}} for (i = 0; i < argc; ++i) foo(); return tmain(argc, argv); } -