[clang] b6e7084 - [OPENMP50]Add parsing/sema analysis for nontemporal clause.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 17 12:00:35 PST 2019
Author: Alexey Bataev
Date: 2019-12-17T14:46:32-05:00
New Revision: b6e7084e25ad0592b8e29ceea6462952e2ad79b9
URL: https://github.com/llvm/llvm-project/commit/b6e7084e25ad0592b8e29ceea6462952e2ad79b9
DIFF: https://github.com/llvm/llvm-project/commit/b6e7084e25ad0592b8e29ceea6462952e2ad79b9.diff
LOG: [OPENMP50]Add parsing/sema analysis for nontemporal clause.
Add basic support for parsing/sema analysis of the nontemporal clause in
simd-based directives.
Added:
Modified:
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/OpenMPKinds.def
clang/include/clang/Sema/Sema.h
clang/lib/AST/OpenMPClause.cpp
clang/lib/AST/StmtProfile.cpp
clang/lib/Basic/OpenMPKinds.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/Parse/ParseOpenMP.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c
clang/test/OpenMP/distribute_simd_ast_print.cpp
clang/test/OpenMP/distribute_simd_misc_messages.c
clang/test/OpenMP/for_simd_ast_print.cpp
clang/test/OpenMP/for_simd_misc_messages.c
clang/test/OpenMP/master_taskloop_simd_ast_print.cpp
clang/test/OpenMP/master_taskloop_simd_misc_messages.c
clang/test/OpenMP/parallel_for_simd_ast_print.cpp
clang/test/OpenMP/parallel_for_simd_misc_messages.c
clang/test/OpenMP/parallel_master_taskloop_simd_ast_print.cpp
clang/test/OpenMP/parallel_master_taskloop_simd_misc_messages.c
clang/test/OpenMP/simd_ast_print.cpp
clang/test/OpenMP/simd_misc_messages.c
clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp
clang/test/OpenMP/target_parallel_for_simd_misc_messages.c
clang/test/OpenMP/target_simd_ast_print.cpp
clang/test/OpenMP/target_simd_misc_messages.c
clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c
clang/test/OpenMP/target_teams_distribute_simd_ast_print.cpp
clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c
clang/test/OpenMP/taskloop_simd_ast_print.cpp
clang/test/OpenMP/taskloop_simd_misc_messages.c
clang/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp
clang/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp
clang/test/OpenMP/teams_distribute_simd_ast_print.cpp
clang/test/OpenMP/teams_distribute_simd_messages.cpp
clang/tools/libclang/CIndex.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/OpenMPClause.h b/clang/include/clang/AST/OpenMPClause.h
index 72c638bf6460..c708b011849a 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -6242,6 +6242,79 @@ class OMPIsDevicePtrClause final
}
};
+/// This represents clause 'nontemporal' in the '#pragma omp ...' directives.
+///
+/// \code
+/// #pragma omp simd nontemporal(a)
+/// \endcode
+/// In this example directive '#pragma omp simd' has clause 'nontemporal' for
+/// the variable 'a'.
+class OMPNontemporalClause final
+ : public OMPVarListClause<OMPNontemporalClause>,
+ private llvm::TrailingObjects<OMPNontemporalClause, Expr *> {
+ friend class OMPClauseReader;
+ friend OMPVarListClause;
+ friend TrailingObjects;
+
+ /// Build clause with number of variables \a N.
+ ///
+ /// \param StartLoc Starting location of the clause.
+ /// \param LParenLoc Location of '('.
+ /// \param EndLoc Ending location of the clause.
+ /// \param N Number of the variables in the clause.
+ OMPNontemporalClause(SourceLocation StartLoc, SourceLocation LParenLoc,
+ SourceLocation EndLoc, unsigned N)
+ : OMPVarListClause<OMPNontemporalClause>(OMPC_nontemporal, StartLoc,
+ LParenLoc, EndLoc, N) {}
+
+ /// Build an empty clause.
+ ///
+ /// \param N Number of variables.
+ explicit OMPNontemporalClause(unsigned N)
+ : OMPVarListClause<OMPNontemporalClause>(
+ OMPC_nontemporal, SourceLocation(), SourceLocation(),
+ SourceLocation(), N) {}
+
+public:
+ /// Creates clause with a list of variables \a VL.
+ ///
+ /// \param C AST context.
+ /// \param StartLoc Starting location of the clause.
+ /// \param LParenLoc Location of '('.
+ /// \param EndLoc Ending location of the clause.
+ /// \param VL List of references to the variables.
+ static OMPNontemporalClause *
+ Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc,
+ SourceLocation EndLoc, ArrayRef<Expr *> VL);
+
+ /// Creates an empty clause with the place for \a N variables.
+ ///
+ /// \param C AST context.
+ /// \param N The number of variables.
+ static OMPNontemporalClause *CreateEmpty(const ASTContext &C, unsigned N);
+
+ child_range children() {
+ return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
+ reinterpret_cast<Stmt **>(varlist_end()));
+ }
+
+ const_child_range children() const {
+ auto Children = const_cast<OMPNontemporalClause *>(this)->children();
+ return const_child_range(Children.begin(), Children.end());
+ }
+
+ child_range used_children() {
+ return child_range(child_iterator(), child_iterator());
+ }
+ const_child_range used_children() const {
+ return const_child_range(const_child_iterator(), const_child_iterator());
+ }
+
+ static bool classof(const OMPClause *T) {
+ return T->getClauseKind() == OMPC_nontemporal;
+ }
+};
+
/// This class implements a simple visitor for OMPClause
/// subclasses.
template<class ImplClass, template <typename> class Ptr, typename RetTy>
diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h
index 768e2cd4bf79..a93a01da34c1 100644
--- a/clang/include/clang/AST/RecursiveASTVisitor.h
+++ b/clang/include/clang/AST/RecursiveASTVisitor.h
@@ -3374,6 +3374,13 @@ bool RecursiveASTVisitor<Derived>::VisitOMPIsDevicePtrClause(
return true;
}
+template <typename Derived>
+bool RecursiveASTVisitor<Derived>::VisitOMPNontemporalClause(
+ OMPNontemporalClause *C) {
+ TRY_TO(VisitOMPClauseList(C));
+ return true;
+}
+
// FIXME: look at the following tricky-seeming exprs to see if we
// need to recurse on anything. These are ones that have methods
// returning decls or qualtypes or nestednamespecifier -- though I'm
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index 3ffbbed17444..c7b501b9bb2b 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9408,8 +9408,8 @@ def err_omp_aligned_expected_array_or_ptr : Error<
"argument of aligned clause should be array"
"%select{ or pointer|, pointer, reference to array or reference to pointer}1"
", not %0">;
-def err_omp_aligned_twice : Error<
- "%select{a variable|a parameter|'this'}0 cannot appear in more than one aligned clause">;
+def err_omp_used_in_clause_twice : Error<
+ "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
def err_omp_local_var_in_threadprivate_init : Error<
"variable with local storage in initial value of threadprivate variable">;
def err_omp_loop_not_canonical_init : Error<
diff --git a/clang/include/clang/Basic/OpenMPKinds.def b/clang/include/clang/Basic/OpenMPKinds.def
index 19ad34888b68..b015826f0e29 100644
--- a/clang/include/clang/Basic/OpenMPKinds.def
+++ b/clang/include/clang/Basic/OpenMPKinds.def
@@ -280,6 +280,7 @@ OPENMP_CLAUSE(reverse_offload, OMPReverseOffloadClause)
OPENMP_CLAUSE(dynamic_allocators, OMPDynamicAllocatorsClause)
OPENMP_CLAUSE(atomic_default_mem_order, OMPAtomicDefaultMemOrderClause)
OPENMP_CLAUSE(allocate, OMPAllocateClause)
+OPENMP_CLAUSE(nontemporal, OMPNontemporalClause)
// Clauses allowed for OpenMP directive 'parallel'.
OPENMP_PARALLEL_CLAUSE(if)
@@ -304,6 +305,7 @@ OPENMP_SIMD_CLAUSE(collapse)
OPENMP_SIMD_CLAUSE(reduction)
OPENMP_SIMD_CLAUSE(allocate)
OPENMP_SIMD_CLAUSE(if)
+OPENMP_SIMD_CLAUSE(nontemporal)
// Clauses allowed for directive 'omp for'.
OPENMP_FOR_CLAUSE(private)
@@ -332,6 +334,7 @@ OPENMP_FOR_SIMD_CLAUSE(aligned)
OPENMP_FOR_SIMD_CLAUSE(ordered)
OPENMP_FOR_SIMD_CLAUSE(allocate)
OPENMP_FOR_SIMD_CLAUSE(if)
+OPENMP_FOR_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'omp sections'.
OPENMP_SECTIONS_CLAUSE(private)
@@ -435,6 +438,7 @@ OPENMP_PARALLEL_FOR_SIMD_CLAUSE(linear)
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(aligned)
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(ordered)
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(allocate)
+OPENMP_PARALLEL_FOR_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'parallel master'.
OPENMP_PARALLEL_MASTER_CLAUSE(if)
@@ -652,6 +656,7 @@ OPENMP_TASKLOOP_SIMD_CLAUSE(num_tasks)
OPENMP_TASKLOOP_SIMD_CLAUSE(reduction)
OPENMP_TASKLOOP_SIMD_CLAUSE(in_reduction)
OPENMP_TASKLOOP_SIMD_CLAUSE(allocate)
+OPENMP_TASKLOOP_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'master taskloop'.
OPENMP_MASTER_TASKLOOP_CLAUSE(if)
@@ -694,6 +699,7 @@ OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(num_tasks)
OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(reduction)
OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(in_reduction)
OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(allocate)
+OPENMP_MASTER_TASKLOOP_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'parallel master taskloop'.
OPENMP_PARALLEL_MASTER_TASKLOOP_CLAUSE(if)
@@ -740,6 +746,7 @@ OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(linear)
OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(aligned)
OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(safelen)
OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(simdlen)
+OPENMP_PARALLEL_MASTER_TASKLOOP_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'critical'.
OPENMP_CRITICAL_CLAUSE(hint)
@@ -790,6 +797,7 @@ OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(aligned)
OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(safelen)
OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(allocate)
+OPENMP_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'distribute simd'
OPENMP_DISTRIBUTE_SIMD_CLAUSE(private)
@@ -804,6 +812,7 @@ OPENMP_DISTRIBUTE_SIMD_CLAUSE(simdlen)
OPENMP_DISTRIBUTE_SIMD_CLAUSE(reduction)
OPENMP_DISTRIBUTE_SIMD_CLAUSE(allocate)
OPENMP_DISTRIBUTE_SIMD_CLAUSE(if)
+OPENMP_DISTRIBUTE_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'target parallel for simd'.
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(if)
@@ -829,6 +838,7 @@ OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(aligned)
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(is_device_ptr)
OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(allocate)
+OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'target simd'.
OPENMP_TARGET_SIMD_CLAUSE(if)
@@ -848,6 +858,7 @@ OPENMP_TARGET_SIMD_CLAUSE(simdlen)
OPENMP_TARGET_SIMD_CLAUSE(collapse)
OPENMP_TARGET_SIMD_CLAUSE(reduction)
OPENMP_TARGET_SIMD_CLAUSE(allocate)
+OPENMP_TARGET_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'teams distribute'.
OPENMP_TEAMS_DISTRIBUTE_CLAUSE(default)
@@ -879,6 +890,7 @@ OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(safelen)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(simdlen)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(allocate)
OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(if)
+OPENMP_TEAMS_DISTRIBUTE_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'teams distribute parallel for simd'
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(firstprivate)
@@ -900,6 +912,7 @@ OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(num_teams)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(thread_limit)
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(allocate)
+OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'teams distribute parallel for'
OPENMP_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(firstprivate)
@@ -1006,6 +1019,7 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(aligned)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(safelen)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(simdlen)
OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(allocate)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'target teams distribute simd'.
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(if)
@@ -1029,6 +1043,7 @@ OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(aligned)
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(safelen)
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(simdlen)
OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(allocate)
+OPENMP_TARGET_TEAMS_DISTRIBUTE_SIMD_CLAUSE(nontemporal)
// Clauses allowed for OpenMP directive 'taskgroup'.
OPENMP_TASKGROUP_CLAUSE(task_reduction)
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 238cd913530a..eb6a4eb10d57 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -10224,6 +10224,11 @@ class Sema final {
/// Called on well-formed 'is_device_ptr' clause.
OMPClause *ActOnOpenMPIsDevicePtrClause(ArrayRef<Expr *> VarList,
const OMPVarListLocTy &Locs);
+ /// Called on well-formed 'nontemporal' clause.
+ OMPClause *ActOnOpenMPNontemporalClause(ArrayRef<Expr *> VarList,
+ SourceLocation StartLoc,
+ SourceLocation LParenLoc,
+ SourceLocation EndLoc);
/// The kind of conversion being performed.
enum CheckedConversionKind {
diff --git a/clang/lib/AST/OpenMPClause.cpp b/clang/lib/AST/OpenMPClause.cpp
index 7315d7c3cdbf..f062c3e463a8 100644
--- a/clang/lib/AST/OpenMPClause.cpp
+++ b/clang/lib/AST/OpenMPClause.cpp
@@ -135,6 +135,7 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
case OMPC_match:
+ case OMPC_nontemporal:
break;
}
@@ -213,6 +214,7 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
case OMPC_match:
+ case OMPC_nontemporal:
break;
}
@@ -1155,6 +1157,25 @@ OMPIsDevicePtrClause::CreateEmpty(const ASTContext &C,
return new (Mem) OMPIsDevicePtrClause(Sizes);
}
+OMPNontemporalClause *OMPNontemporalClause::Create(const ASTContext &C,
+ SourceLocation StartLoc,
+ SourceLocation LParenLoc,
+ SourceLocation EndLoc,
+ ArrayRef<Expr *> VL) {
+ // Allocate space for nontemporal variables.
+ void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(VL.size()));
+ auto *Clause =
+ new (Mem) OMPNontemporalClause(StartLoc, LParenLoc, EndLoc, VL.size());
+ Clause->setVarRefs(VL);
+ return Clause;
+}
+
+OMPNontemporalClause *OMPNontemporalClause::CreateEmpty(const ASTContext &C,
+ unsigned N) {
+ void *Mem = C.Allocate(totalSizeToAlloc<Expr *>(N));
+ return new (Mem) OMPNontemporalClause(N);
+}
+
//===----------------------------------------------------------------------===//
// OpenMP clauses printing methods
//===----------------------------------------------------------------------===//
@@ -1648,3 +1669,10 @@ void OMPClausePrinter::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *Node) {
}
}
+void OMPClausePrinter::VisitOMPNontemporalClause(OMPNontemporalClause *Node) {
+ if (!Node->varlist_empty()) {
+ OS << "nontemporal";
+ VisitOMPClauseList(Node, '(');
+ OS << ")";
+ }
+}
diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index c94d2c54bae2..56a65e8deb98 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -769,6 +769,9 @@ void OMPClauseProfiler::VisitOMPIsDevicePtrClause(
const OMPIsDevicePtrClause *C) {
VisitOMPClauseList(C);
}
+void OMPClauseProfiler::VisitOMPNontemporalClause(const OMPNontemporalClause *C) {
+ VisitOMPClauseList(C);
+}
}
void
diff --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp
index 6dadfce1eb83..3222db713653 100644
--- a/clang/lib/Basic/OpenMPKinds.cpp
+++ b/clang/lib/Basic/OpenMPKinds.cpp
@@ -223,6 +223,7 @@ unsigned clang::getOpenMPSimpleClauseType(OpenMPClauseKind Kind,
case OMPC_reverse_offload:
case OMPC_dynamic_allocators:
case OMPC_match:
+ case OMPC_nontemporal:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
@@ -417,6 +418,7 @@ const char *clang::getOpenMPSimpleClauseTypeName(OpenMPClauseKind Kind,
case OMPC_reverse_offload:
case OMPC_dynamic_allocators:
case OMPC_match:
+ case OMPC_nontemporal:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
@@ -427,6 +429,9 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
unsigned OpenMPVersion) {
assert(unsigned(DKind) <= unsigned(OMPD_unknown));
assert(CKind <= OMPC_unknown);
+ // Nontemporal clause is not supported in OpenMP < 5.0.
+ if (OpenMPVersion < 50 && CKind == OMPC_nontemporal)
+ return false;
switch (DKind) {
case OMPD_parallel:
switch (CKind) {
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 3c266a5a3149..e8a3790e3b5c 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4206,6 +4206,7 @@ static void emitOMPAtomicExpr(CodeGenFunction &CGF, OpenMPClauseKind Kind,
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
case OMPC_match:
+ case OMPC_nontemporal:
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
}
}
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 9dbbcc08db86..181ed3313253 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -2194,6 +2194,7 @@ OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
case OMPC_use_device_ptr:
case OMPC_is_device_ptr:
case OMPC_allocate:
+ case OMPC_nontemporal:
Clause = ParseOpenMPVarListClause(DKind, CKind, WrongDirective);
break;
case OMPC_device_type:
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index afe0f1a0dcde..915bf53d06e3 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -83,7 +83,7 @@ class DSAStackTy {
DeclRefExpr *PrivateCopy = nullptr;
};
using DeclSAMapTy = llvm::SmallDenseMap<const ValueDecl *, DSAInfo, 8>;
- using AlignedMapTy = llvm::SmallDenseMap<const ValueDecl *, const Expr *, 8>;
+ using UsedRefMapTy = llvm::SmallDenseMap<const ValueDecl *, const Expr *, 8>;
using LCDeclInfo = std::pair<unsigned, VarDecl *>;
using LoopControlVariablesMapTy =
llvm::SmallDenseMap<const ValueDecl *, LCDeclInfo, 8>;
@@ -125,7 +125,8 @@ class DSAStackTy {
struct SharingMapTy {
DeclSAMapTy SharingMap;
DeclReductionMapTy ReductionMap;
- AlignedMapTy AlignedMap;
+ UsedRefMapTy AlignedMap;
+ UsedRefMapTy NontemporalMap;
MappedExprComponentsTy MappedExprComponents;
LoopControlVariablesMapTy LCVMap;
DefaultDataSharingAttributes DefaultAttr = DSA_unspecified;
@@ -421,6 +422,10 @@ class DSAStackTy {
/// add it and return NULL; otherwise return previous occurrence's expression
/// for diagnostics.
const Expr *addUniqueAligned(const ValueDecl *D, const Expr *NewDE);
+ /// If 'nontemporal' declaration for given variable \a D was not seen yet,
+ /// add it and return NULL; otherwise return previous occurrence's expression
+ /// for diagnostics.
+ const Expr *addUniqueNontemporal(const ValueDecl *D, const Expr *NewDE);
/// Register specified variable as loop control variable.
void addLoopControlVariable(const ValueDecl *D, VarDecl *Capture);
@@ -1073,6 +1078,21 @@ const Expr *DSAStackTy::addUniqueAligned(const ValueDecl *D,
return It->second;
}
+const Expr *DSAStackTy::addUniqueNontemporal(const ValueDecl *D,
+ const Expr *NewDE) {
+ assert(!isStackEmpty() && "Data sharing attributes stack is empty");
+ D = getCanonicalDecl(D);
+ SharingMapTy &StackElem = getTopOfStack();
+ auto It = StackElem.NontemporalMap.find(D);
+ if (It == StackElem.NontemporalMap.end()) {
+ assert(NewDE && "Unexpected nullptr expr to be added into aligned map");
+ StackElem.NontemporalMap[D] = NewDE;
+ return nullptr;
+ }
+ assert(It->second && "Unexpected nullptr expr in the aligned map");
+ return It->second;
+}
+
void DSAStackTy::addLoopControlVariable(const ValueDecl *D, VarDecl *Capture) {
assert(!isStackEmpty() && "Data-sharing attributes stack is empty");
D = getCanonicalDecl(D);
@@ -4874,6 +4894,7 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
case OMPC_from:
case OMPC_use_device_ptr:
case OMPC_is_device_ptr:
+ case OMPC_nontemporal:
continue;
case OMPC_allocator:
case OMPC_flush:
@@ -5019,8 +5040,9 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPDeclareSimdDirective(
// OpenMP [2.8.1, simd construct, Restrictions]
// A list-item cannot appear in more than one aligned clause.
if (AlignedArgs.count(CanonPVD) > 0) {
- Diag(E->getExprLoc(), diag::err_omp_aligned_twice)
- << 1 << E->getSourceRange();
+ Diag(E->getExprLoc(), diag::err_omp_used_in_clause_twice)
+ << 1 << getOpenMPClauseName(OMPC_aligned)
+ << E->getSourceRange();
Diag(AlignedArgs[CanonPVD]->getExprLoc(),
diag::note_omp_explicit_dsa)
<< getOpenMPClauseName(OMPC_aligned);
@@ -5042,8 +5064,8 @@ Sema::DeclGroupPtrTy Sema::ActOnOpenMPDeclareSimdDirective(
}
if (isa<CXXThisExpr>(E)) {
if (AlignedThis) {
- Diag(E->getExprLoc(), diag::err_omp_aligned_twice)
- << 2 << E->getSourceRange();
+ Diag(E->getExprLoc(), diag::err_omp_used_in_clause_twice)
+ << 2 << getOpenMPClauseName(OMPC_aligned) << E->getSourceRange();
Diag(AlignedThis->getExprLoc(), diag::note_omp_explicit_dsa)
<< getOpenMPClauseName(OMPC_aligned);
}
@@ -10735,6 +10757,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
case OMPC_match:
+ case OMPC_nontemporal:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@@ -11445,6 +11468,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
case OMPC_match:
+ case OMPC_nontemporal:
llvm_unreachable("Unexpected OpenMP clause.");
}
return CaptureRegion;
@@ -11868,6 +11892,7 @@ OMPClause *Sema::ActOnOpenMPSimpleClause(
case OMPC_dynamic_allocators:
case OMPC_device_type:
case OMPC_match:
+ case OMPC_nontemporal:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@@ -12048,6 +12073,7 @@ OMPClause *Sema::ActOnOpenMPSingleExprWithArgClause(
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
case OMPC_match:
+ case OMPC_nontemporal:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@@ -12259,6 +12285,7 @@ OMPClause *Sema::ActOnOpenMPClause(OpenMPClauseKind Kind,
case OMPC_atomic_default_mem_order:
case OMPC_device_type:
case OMPC_match:
+ case OMPC_nontemporal:
llvm_unreachable("Clause is not allowed.");
}
return Res;
@@ -12426,6 +12453,9 @@ OMPClause *Sema::ActOnOpenMPVarListClause(
Res = ActOnOpenMPAllocateClause(TailExpr, VarList, StartLoc, LParenLoc,
ColonLoc, EndLoc);
break;
+ case OMPC_nontemporal:
+ Res = ActOnOpenMPNontemporalClause(VarList, StartLoc, LParenLoc, EndLoc);
+ break;
case OMPC_if:
case OMPC_final:
case OMPC_num_threads:
@@ -14553,7 +14583,8 @@ OMPClause *Sema::ActOnOpenMPAlignedClause(
// OpenMP [2.8.1, simd construct, Restrictions]
// A list-item cannot appear in more than one aligned clause.
if (const Expr *PrevRef = DSAStack->addUniqueAligned(D, SimpleRefExpr)) {
- Diag(ELoc, diag::err_omp_aligned_twice) << 0 << ERange;
+ Diag(ELoc, diag::err_omp_used_in_clause_twice)
+ << 0 << getOpenMPClauseName(OMPC_aligned) << ERange;
Diag(PrevRef->getExprLoc(), diag::note_omp_explicit_dsa)
<< getOpenMPClauseName(OMPC_aligned);
continue;
@@ -17122,3 +17153,49 @@ OMPClause *Sema::ActOnOpenMPAllocateClause(
return OMPAllocateClause::Create(Context, StartLoc, LParenLoc, Allocator,
ColonLoc, EndLoc, Vars);
}
+
+OMPClause *Sema::ActOnOpenMPNontemporalClause(ArrayRef<Expr *> VarList,
+ SourceLocation StartLoc,
+ SourceLocation LParenLoc,
+ SourceLocation EndLoc) {
+ SmallVector<Expr *, 8> Vars;
+ for (Expr *RefExpr : VarList) {
+ assert(RefExpr && "NULL expr in OpenMP nontemporal clause.");
+ SourceLocation ELoc;
+ SourceRange ERange;
+ Expr *SimpleRefExpr = RefExpr;
+ auto Res = getPrivateItem(*this, SimpleRefExpr, ELoc, ERange);
+ if (Res.second)
+ // It will be analyzed later.
+ Vars.push_back(RefExpr);
+ ValueDecl *D = Res.first;
+ if (!D)
+ continue;
+
+ auto *VD = dyn_cast<VarDecl>(D);
+
+ // OpenMP 5.0, 2.9.3.1 simd Construct, Restrictions.
+ // A list-item cannot appear in more than one nontemporal clause.
+ if (const Expr *PrevRef =
+ DSAStack->addUniqueNontemporal(D, SimpleRefExpr)) {
+ Diag(ELoc, diag::err_omp_used_in_clause_twice)
+ << 0 << getOpenMPClauseName(OMPC_nontemporal) << ERange;
+ Diag(PrevRef->getExprLoc(), diag::note_omp_explicit_dsa)
+ << getOpenMPClauseName(OMPC_nontemporal);
+ continue;
+ }
+
+ DeclRefExpr *Ref = nullptr;
+ if (!VD && isOpenMPCapturedDecl(D) && !CurContext->isDependentContext())
+ Ref = buildCapture(*this, D, SimpleRefExpr, /*WithInit=*/true);
+ Vars.push_back((VD || !Ref || CurContext->isDependentContext())
+ ? RefExpr->IgnoreParens()
+ : Ref);
+ }
+
+ if (Vars.empty())
+ return nullptr;
+
+ return OMPNontemporalClause::Create(Context, StartLoc, LParenLoc, EndLoc,
+ Vars);
+}
diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h
index 2e4e91285060..2860db365f3b 100644
--- a/clang/lib/Sema/TreeTransform.h
+++ b/clang/lib/Sema/TreeTransform.h
@@ -22,6 +22,7 @@
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExprOpenMP.h"
+#include "clang/AST/OpenMPClause.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/StmtObjC.h"
@@ -2001,6 +2002,18 @@ class TreeTransform {
MLoc, KindLoc, EndLoc);
}
+ /// Build a new OpenMP 'nontemporal' clause.
+ ///
+ /// By default, performs semantic analysis to build the new OpenMP clause.
+ /// Subclasses may override this routine to provide
diff erent behavior.
+ OMPClause *RebuildOMPNontemporalClause(ArrayRef<Expr *> VarList,
+ SourceLocation StartLoc,
+ SourceLocation LParenLoc,
+ SourceLocation EndLoc) {
+ return getSema().ActOnOpenMPNontemporalClause(VarList, StartLoc, LParenLoc,
+ EndLoc);
+ }
+
/// Rebuild the operand to an Objective-C \@synchronized statement.
///
/// By default, performs semantic analysis to build the new statement.
@@ -9266,6 +9279,21 @@ TreeTransform<Derived>::TransformOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {
return getDerived().RebuildOMPIsDevicePtrClause(Vars, Locs);
}
+template <typename Derived>
+OMPClause *
+TreeTransform<Derived>::TransformOMPNontemporalClause(OMPNontemporalClause *C) {
+ llvm::SmallVector<Expr *, 16> Vars;
+ Vars.reserve(C->varlist_size());
+ for (auto *VE : C->varlists()) {
+ ExprResult EVar = getDerived().TransformExpr(cast<Expr>(VE));
+ if (EVar.isInvalid())
+ return nullptr;
+ Vars.push_back(EVar.get());
+ }
+ return getDerived().RebuildOMPNontemporalClause(
+ Vars, C->getBeginLoc(), C->getLParenLoc(), C->getEndLoc());
+}
+
//===----------------------------------------------------------------------===//
// Expression transformation
//===----------------------------------------------------------------------===//
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index a2e4e7b469c9..9258a6fb1265 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -11698,6 +11698,9 @@ OMPClause *OMPClauseReader::readClause() {
case OMPC_allocate:
C = OMPAllocateClause::CreateEmpty(Context, Record.readInt());
break;
+ case OMPC_nontemporal:
+ C = OMPNontemporalClause::CreateEmpty(Context, Record.readInt());
+ break;
}
assert(C && "Unknown OMPClause type");
@@ -12454,3 +12457,13 @@ void OMPClauseReader::VisitOMPIsDevicePtrClause(OMPIsDevicePtrClause *C) {
}
C->setComponents(Components, ListSizes);
}
+
+void OMPClauseReader::VisitOMPNontemporalClause(OMPNontemporalClause *C) {
+ C->setLParenLoc(Record.readSourceLocation());
+ unsigned NumVars = C->varlist_size();
+ SmallVector<Expr *, 16> Vars;
+ Vars.reserve(NumVars);
+ for (unsigned i = 0; i != NumVars; ++i)
+ Vars.push_back(Record.readSubExpr());
+ C->setVarRefs(Vars);
+}
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index a8ea8563a1dc..a632072d01bd 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -10,6 +10,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/OpenMPClause.h"
#include "clang/Serialization/ASTRecordWriter.h"
#include "ASTCommon.h"
#include "ASTReaderInternals.h"
@@ -6537,3 +6538,10 @@ void OMPClauseWriter::VisitOMPAtomicDefaultMemOrderClause(
Record.AddSourceLocation(C->getLParenLoc());
Record.AddSourceLocation(C->getAtomicDefaultMemOrderKindKwLoc());
}
+
+void OMPClauseWriter::VisitOMPNontemporalClause(OMPNontemporalClause *C) {
+ Record.push_back(C->varlist_size());
+ Record.AddSourceLocation(C->getLParenLoc());
+ for (auto *VE : C->varlists())
+ Record.AddStmt(VE);
+}
diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp b/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
index 5837e2f04165..79b29f44b94b 100644
--- a/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
+++ b/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp
@@ -150,7 +150,7 @@ int main(int argc, char **argv) {
#pragma omp target
#pragma omp teams
#ifdef OMP5
-#pragma omp distribute parallel for simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(simd: argc)
+#pragma omp distribute parallel for simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc, c, d)
#else
#pragma omp distribute parallel for simd aligned(x:8) linear(i:2) safelen(8) simdlen(8)
#endif // OMP5
@@ -158,7 +158,7 @@ int main(int argc, char **argv) {
for (int j = 0; j < 200; j++)
a += h + x[j];
// OMP45: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8)
- // OMP50: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(simd: argc)
+ // OMP50: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc,c,d)
// CHECK-NEXT: for (i = 0; i < 100; i++)
// CHECK-NEXT: for (int j = 0; j < 200; j++)
// CHECK-NEXT: a += h + x[j];
diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c b/clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c
index 1721da876dc5..6b6c5d689d68 100644
--- a/clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c
+++ b/clang/test/OpenMP/distribute_parallel_for_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -898,3 +900,87 @@ void test_loop_messages() {
}
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp distribute parallel for simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp distribute parallel for simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp distribute parallel for simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp distribute parallel for simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp distribute parallel for simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp distribute parallel for simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp distribute parallel for simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp distribute parallel for simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp distribute parallel for simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp distribute parallel for simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp distribute parallel for simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp distribute parallel for simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}}
+#pragma omp distribute parallel for simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}}
+#pragma omp distribute parallel for simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp distribute parallel for simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}}
+#pragma omp distribute parallel for simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute parallel for simd'}}
+#pragma omp distribute parallel for simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/distribute_simd_ast_print.cpp b/clang/test/OpenMP/distribute_simd_ast_print.cpp
index f6de4274acf6..28f8c51a537f 100644
--- a/clang/test/OpenMP/distribute_simd_ast_print.cpp
+++ b/clang/test/OpenMP/distribute_simd_ast_print.cpp
@@ -148,7 +148,7 @@ int main(int argc, char **argv) {
#pragma omp target
#pragma omp teams
#ifdef OMP5
-#pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(argc)
+#pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d)
#else
#pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8)
#endif // OMP5
@@ -156,7 +156,7 @@ int main(int argc, char **argv) {
for (int j = 0; j < 200; j++)
a += h + x[j];
// OMP45: #pragma omp distribute simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8)
-// OMP50: #pragma omp distribute simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(argc)
+// OMP50: #pragma omp distribute simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d)
// CHECK-NEXT: for (i = 0; i < 100; i++)
// CHECK-NEXT: for (int j = 0; j < 200; j++)
// CHECK-NEXT: a += h + x[j];
diff --git a/clang/test/OpenMP/distribute_simd_misc_messages.c b/clang/test/OpenMP/distribute_simd_misc_messages.c
index 4c82b7a96b03..e5e975198f9e 100644
--- a/clang/test/OpenMP/distribute_simd_misc_messages.c
+++ b/clang/test/OpenMP/distribute_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -1032,3 +1034,87 @@ void linear_modifiers(int argc) {
for (k = 0; k < argc; ++k) ++k;
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp distribute simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp distribute simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp distribute simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 {{expected expression}}
+#pragma omp distribute simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 {{expected expression}}
+#pragma omp distribute simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp distribute simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp distribute simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp distribute simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp distribute simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp distribute simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp distribute simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp distribute simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}}
+#pragma omp distribute simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}}
+#pragma omp distribute simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp distribute simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}}
+#pragma omp distribute simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp distribute simd'}}
+#pragma omp distribute simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/for_simd_ast_print.cpp b/clang/test/OpenMP/for_simd_ast_print.cpp
index 45d8f699a48d..df842159909a 100644
--- a/clang/test/OpenMP/for_simd_ast_print.cpp
+++ b/clang/test/OpenMP/for_simd_ast_print.cpp
@@ -97,11 +97,11 @@ template<class T> struct S {
// CHECK: T val;
// CHECK: T lin = 0;
#ifdef OMP5
- #pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) allocate(res) if(res)
+ #pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) allocate(res) if(res) nontemporal(res, val, lin)
#else
#pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) allocate(res)
#endif
-// OMP50-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) allocate(res) if(res)
+// OMP50-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) allocate(res) if(res) nontemporal(res,val,lin)
// OMP45-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) allocate(res)
for (T i = 7; i < m_a; ++i) {
val = v[i-7] + m_a;
diff --git a/clang/test/OpenMP/for_simd_misc_messages.c b/clang/test/OpenMP/for_simd_misc_messages.c
index ced5ee50cb59..1ab4f9de3753 100644
--- a/clang/test/OpenMP/for_simd_misc_messages.c
+++ b/clang/test/OpenMP/for_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 -verify %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -763,3 +765,89 @@ void test_loop_messages() {
}
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp for simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp for simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp for simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp for simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp for simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp for simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp for simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp for simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp for simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp for simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp for simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp for simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}}
+#pragma omp for simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}}
+#pragma omp for simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp for simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp parallel
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}}
+#pragma omp for simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp parallel
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp for simd'}}
+#pragma omp for simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/master_taskloop_simd_ast_print.cpp b/clang/test/OpenMP/master_taskloop_simd_ast_print.cpp
index e5892303d8f8..04881fde3730 100644
--- a/clang/test/OpenMP/master_taskloop_simd_ast_print.cpp
+++ b/clang/test/OpenMP/master_taskloop_simd_ast_print.cpp
@@ -76,7 +76,7 @@ int main(int argc, char **argv) {
// CHECK-NEXT: a = 2;
#pragma omp parallel
#ifdef OMP5
-#pragma omp master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd:argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e)
+#pragma omp master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd:argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e) nontemporal(argc, c, d)
#else
#pragma omp master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e)
#endif // OMP5
@@ -84,7 +84,7 @@ int main(int argc, char **argv) {
for (int j = 0; j < 10; ++j)
foo();
// CHECK-NEXT: #pragma omp parallel
- // OMP50-NEXT: #pragma omp master taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e)
+ // OMP50-NEXT: #pragma omp master taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e) nontemporal(argc,c,d)
// OMP45-NEXT: #pragma omp master taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: for (int j = 0; j < 10; ++j)
diff --git a/clang/test/OpenMP/master_taskloop_simd_misc_messages.c b/clang/test/OpenMP/master_taskloop_simd_misc_messages.c
index ab8759a6d20b..f9de78612dec 100644
--- a/clang/test/OpenMP/master_taskloop_simd_misc_messages.c
+++ b/clang/test/OpenMP/master_taskloop_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -triple x86_64-unknown-unknown -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 -triple x86_64-unknown-unknown %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 -triple x86_64-unknown-unknown %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -triple x86_64-unknown-unknown -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 -triple x86_64-unknown-unknown %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 -triple x86_64-unknown-unknown %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -383,3 +385,87 @@ void test_loop_messages() {
}
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp master taskloop simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp master taskloop simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp master taskloop simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 {{expected expression}}
+#pragma omp master taskloop simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 {{expected expression}}
+#pragma omp master taskloop simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp master taskloop simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp master taskloop simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp master taskloop simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp master taskloop simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp master taskloop simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp master taskloop simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp master taskloop simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}}
+#pragma omp master taskloop simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}}
+#pragma omp master taskloop simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp master taskloop simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}}
+#pragma omp master taskloop simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp master taskloop simd'}}
+#pragma omp master taskloop simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/parallel_for_simd_ast_print.cpp b/clang/test/OpenMP/parallel_for_simd_ast_print.cpp
index 7ffecce30d51..74716c62dab9 100644
--- a/clang/test/OpenMP/parallel_for_simd_ast_print.cpp
+++ b/clang/test/OpenMP/parallel_for_simd_ast_print.cpp
@@ -1,10 +1,16 @@
-// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
// 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 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -DOMP5 -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -DOMP5 -x c++ -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -DOMP5 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
-// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
// 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
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -DOMP5 -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -DOMP5 -x c++ -std=c++11 -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -DOMP5 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50
// expected-no-diagnostics
#ifndef HEADER
@@ -148,8 +154,13 @@ int main (int argc, char **argv) {
int k1=0,k2=0;
static int *a;
// CHECK: static int *a;
+#ifdef OMP5
+#pragma omp parallel for simd if(parallel :b) ordered if(simd: b) nontemporal(argc, c)
+#else
#pragma omp parallel for simd if(parallel :b) ordered
-// CHECK-NEXT: #pragma omp parallel for simd if(parallel: b) ordered
+#endif // OMP5
+// OMP50-NEXT: #pragma omp parallel for simd if(parallel: b) ordered if(simd: b) nontemporal(argc,c)
+// OMP45-NEXT: #pragma omp parallel for simd if(parallel: b) ordered
for (int i=0; i < 2; ++i)*a=2;
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: *a = 2;
diff --git a/clang/test/OpenMP/parallel_for_simd_misc_messages.c b/clang/test/OpenMP/parallel_for_simd_misc_messages.c
index 2dd64d3155f5..0ec5dde53c51 100644
--- a/clang/test/OpenMP/parallel_for_simd_misc_messages.c
+++ b/clang/test/OpenMP/parallel_for_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
// expected-error at +1 {{unexpected OpenMP directive '#pragma omp parallel for simd'}}
#pragma omp parallel for simd
@@ -754,3 +756,87 @@ void test_loop_messages() {
}
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp parallel for simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp parallel for simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp parallel for simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp parallel for simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp parallel for simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp parallel for simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp parallel for simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp parallel for simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp parallel for simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp parallel for simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp parallel for simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp parallel for simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}}
+#pragma omp parallel for simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}}
+#pragma omp parallel for simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp parallel for simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}}
+#pragma omp parallel for simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel for simd'}}
+#pragma omp parallel for simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/parallel_master_taskloop_simd_ast_print.cpp b/clang/test/OpenMP/parallel_master_taskloop_simd_ast_print.cpp
index 471aa4dcf312..3655a8128eb5 100644
--- a/clang/test/OpenMP/parallel_master_taskloop_simd_ast_print.cpp
+++ b/clang/test/OpenMP/parallel_master_taskloop_simd_ast_print.cpp
@@ -75,7 +75,7 @@ int main(int argc, char **argv) {
// CHECK-NEXT: a = 2;
#pragma omp parallel
#ifdef OMP5
-#pragma omp parallel master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd:argc) mergeable priority(argc) grainsize(argc) reduction(max: a, e)
+#pragma omp parallel master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd:argc) mergeable priority(argc) grainsize(argc) reduction(max: a, e) nontemporal(argc, c, d)
#else
#pragma omp parallel master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(argc) mergeable priority(argc) grainsize(argc) reduction(max: a, e)
#endif // OMP5
@@ -84,7 +84,7 @@ int main(int argc, char **argv) {
foo();
// CHECK-NEXT: #pragma omp parallel
// OMP45-NEXT: #pragma omp parallel master taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(argc) mergeable priority(argc) grainsize(argc) reduction(max: a,e)
- // OMP50-NEXT: #pragma omp parallel master taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) grainsize(argc) reduction(max: a,e)
+ // OMP50-NEXT: #pragma omp parallel master taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) grainsize(argc) reduction(max: a,e) nontemporal(argc,c,d)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: for (int j = 0; j < 10; ++j)
// CHECK-NEXT: foo();
diff --git a/clang/test/OpenMP/parallel_master_taskloop_simd_misc_messages.c b/clang/test/OpenMP/parallel_master_taskloop_simd_misc_messages.c
index c6756b88580a..1553f88289aa 100644
--- a/clang/test/OpenMP/parallel_master_taskloop_simd_misc_messages.c
+++ b/clang/test/OpenMP/parallel_master_taskloop_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -triple x86_64-unknown-unknown -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 -triple x86_64-unknown-unknown %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 -triple x86_64-unknown-unknown %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -triple x86_64-unknown-unknown -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 -triple x86_64-unknown-unknown %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 -triple x86_64-unknown-unknown %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -382,3 +384,87 @@ void test_loop_messages() {
}
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp parallel master taskloop simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp parallel master taskloop simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp parallel master taskloop simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 {{expected expression}}
+#pragma omp parallel master taskloop simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 {{expected expression}}
+#pragma omp parallel master taskloop simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp parallel master taskloop simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp parallel master taskloop simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp parallel master taskloop simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp parallel master taskloop simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp parallel master taskloop simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp parallel master taskloop simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp parallel master taskloop simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}}
+#pragma omp parallel master taskloop simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}}
+#pragma omp parallel master taskloop simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp parallel master taskloop simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}}
+#pragma omp parallel master taskloop simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp parallel master taskloop simd'}}
+#pragma omp parallel master taskloop simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/simd_ast_print.cpp b/clang/test/OpenMP/simd_ast_print.cpp
index c538924e93c4..62f6a2459cce 100644
--- a/clang/test/OpenMP/simd_ast_print.cpp
+++ b/clang/test/OpenMP/simd_ast_print.cpp
@@ -164,8 +164,8 @@ int main (int argc, char **argv) {
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
// CHECK-NEXT: *a = 2;
#ifdef OMP5
-#pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4) if(simd:a)
-// OMP50-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4) if(simd: a)
+#pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4) if(simd:a) nontemporal(argc, c, d)
+// OMP50-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4) if(simd: a) nontemporal(argc,c,d)
#else
#pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4)
// OMP45-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4)
diff --git a/clang/test/OpenMP/simd_misc_messages.c b/clang/test/OpenMP/simd_misc_messages.c
index 29dbde4da8ac..d8322e493fa5 100644
--- a/clang/test/OpenMP/simd_misc_messages.c
+++ b/clang/test/OpenMP/simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -804,3 +806,87 @@ void linear_modifiers(int argc) {
for (int k = 0; k < argc; ++k) ++k;
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 {{expected expression}}
+#pragma omp simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 {{expected expression}}
+#pragma omp simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}}
+#pragma omp simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}}
+#pragma omp simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}}
+#pragma omp simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp simd'}}
+#pragma omp simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp b/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp
index 91f3551d0603..935010f782c1 100644
--- a/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp
+++ b/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp
@@ -115,13 +115,13 @@ T tmain(T argc, T *argv) {
// CHECK-NEXT: }
#ifdef OMP5
-#pragma omp target parallel for simd if(target:argc > 0) if (simd: argc)
+#pragma omp target parallel for simd if(target:argc > 0) if (simd: argc) nontemporal(argc, c, d)
#else
#pragma omp target parallel for simd if(target:argc > 0)
#endif // OMP5
for (T i = 0; i < 2; ++i) {}
// OMP45: #pragma omp target parallel for simd if(target: argc > 0)
- // OMP50: #pragma omp target parallel for simd if(target: argc > 0) if(simd: argc)
+ // OMP50: #pragma omp target parallel for simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d)
// CHECK-NEXT: for (T i = 0; i < 2; ++i) {
// CHECK-NEXT: }
diff --git a/clang/test/OpenMP/target_parallel_for_simd_misc_messages.c b/clang/test/OpenMP/target_parallel_for_simd_misc_messages.c
index b11f57dc7548..29011a2c9ba7 100644
--- a/clang/test/OpenMP/target_parallel_for_simd_misc_messages.c
+++ b/clang/test/OpenMP/target_parallel_for_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
// expected-error at +1 {{unexpected OpenMP directive '#pragma omp target parallel for simd'}}
#pragma omp target parallel for simd
@@ -495,3 +497,88 @@ void test_safelen_simdlen() {
for (i = 0; i < 16; ++i)
;
}
+
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target parallel for simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target parallel for simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp target parallel for simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp target parallel for simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp target parallel for simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp target parallel for simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp target parallel for simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp target parallel for simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp target parallel for simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target parallel for simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp target parallel for simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp target parallel for simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}}
+#pragma omp target parallel for simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}}
+#pragma omp target parallel for simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp target parallel for simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}}
+#pragma omp target parallel for simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target parallel for simd'}}
+#pragma omp target parallel for simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/target_simd_ast_print.cpp b/clang/test/OpenMP/target_simd_ast_print.cpp
index e754b957cfd6..b5e3bf6461aa 100644
--- a/clang/test/OpenMP/target_simd_ast_print.cpp
+++ b/clang/test/OpenMP/target_simd_ast_print.cpp
@@ -242,13 +242,13 @@ int main(int argc, char **argv) {
// CHECK-NEXT: }
#ifdef OMP5
-#pragma omp target simd if (target:argc > 0) if(simd:argc)
+#pragma omp target simd if (target:argc > 0) if(simd:argc) nontemporal(argc, c, d)
#else
#pragma omp target simd if (target:argc > 0)
#endif // OMP5
for (int i = 0; i < 2; ++i) {}
// OMP45: #pragma omp target simd if(target: argc > 0)
- // OMP50: #pragma omp target simd if(target: argc > 0) if(simd: argc)
+ // OMP50: #pragma omp target simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d)
// CHECK-NEXT: for (int i = 0; i < 2; ++i) {
// CHECK-NEXT: }
diff --git a/clang/test/OpenMP/target_simd_misc_messages.c b/clang/test/OpenMP/target_simd_misc_messages.c
index 83d73fa013a6..36bbb226f59e 100644
--- a/clang/test/OpenMP/target_simd_misc_messages.c
+++ b/clang/test/OpenMP/target_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
// expected-error at +1 {{unexpected OpenMP directive '#pragma omp target simd'}}
#pragma omp target simd
@@ -485,3 +487,88 @@ void test_safelen_simdlen() {
for (i = 0; i < 16; ++i)
;
}
+
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp target simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 {{expected expression}}
+#pragma omp target simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 {{expected expression}}
+#pragma omp target simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp target simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp target simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp target simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp target simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp target simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp target simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}}
+#pragma omp target simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}}
+#pragma omp target simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp target simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}}
+#pragma omp target simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target simd'}}
+#pragma omp target simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c
index f2a870ecb900..97a7607cdaa3 100644
--- a/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c
+++ b/clang/test/OpenMP/target_teams_distribute_parallel_for_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
// expected-error at +1 {{unexpected OpenMP directive '#pragma omp target teams distribute parallel for simd'}}
#pragma omp target teams distribute parallel for simd
@@ -319,3 +321,87 @@ void test_loop_messages() {
}
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target teams distribute parallel for simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target teams distribute parallel for simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp target teams distribute parallel for simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp target teams distribute parallel for simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp target teams distribute parallel for simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp target teams distribute parallel for simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp target teams distribute parallel for simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp target teams distribute parallel for simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp target teams distribute parallel for simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target teams distribute parallel for simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp target teams distribute parallel for simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp target teams distribute parallel for simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}}
+#pragma omp target teams distribute parallel for simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}}
+#pragma omp target teams distribute parallel for simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp target teams distribute parallel for simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}}
+#pragma omp target teams distribute parallel for simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute parallel for simd'}}
+#pragma omp target teams distribute parallel for simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/target_teams_distribute_simd_ast_print.cpp b/clang/test/OpenMP/target_teams_distribute_simd_ast_print.cpp
index 94a2f666e575..6e74c2bd990e 100644
--- a/clang/test/OpenMP/target_teams_distribute_simd_ast_print.cpp
+++ b/clang/test/OpenMP/target_teams_distribute_simd_ast_print.cpp
@@ -198,14 +198,14 @@ int main (int argc, char **argv) {
// CHECK-NEXT: for (int k = 0; k < 10; ++k)
// CHECK-NEXT: e += d + argc;
#ifdef OMP5
-#pragma omp target teams distribute simd safelen(clen-1) aligned(arr:N+6) if(simd:argc)
+#pragma omp target teams distribute simd safelen(clen-1) aligned(arr:N+6) if(simd:argc) nontemporal(argc, c, d)
#else
#pragma omp target teams distribute simd safelen(clen-1) aligned(arr:N+6)
#endif // OMP5
for (int k = 0; k < 10; ++k)
e += d + argc + arr[k];
// OMP45: #pragma omp target teams distribute simd safelen(clen - 1) aligned(arr: N + 6)
-// OMP50: #pragma omp target teams distribute simd safelen(clen - 1) aligned(arr: N + 6) if(simd: argc)
+// OMP50: #pragma omp target teams distribute simd safelen(clen - 1) aligned(arr: N + 6) if(simd: argc) nontemporal(argc,c,d)
// CHECK-NEXT: for (int k = 0; k < 10; ++k)
// CHECK-NEXT: e += d + argc + arr[k];
return (0);
diff --git a/clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c b/clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c
index 16f595d679bb..18c33a155f28 100644
--- a/clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c
+++ b/clang/test/OpenMP/target_teams_distribute_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
// expected-error at +1 {{unexpected OpenMP directive '#pragma omp target teams distribute simd'}}
#pragma omp target teams distribute simd
@@ -319,3 +321,87 @@ void test_loop_messages() {
}
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target teams distribute simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target teams distribute simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp target teams distribute simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 {{expected expression}}
+#pragma omp target teams distribute simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 {{expected expression}}
+#pragma omp target teams distribute simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp target teams distribute simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp target teams distribute simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp target teams distribute simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp target teams distribute simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp target teams distribute simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp target teams distribute simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp target teams distribute simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}}
+#pragma omp target teams distribute simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}}
+#pragma omp target teams distribute simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp target teams distribute simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}}
+#pragma omp target teams distribute simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp target teams distribute simd'}}
+#pragma omp target teams distribute simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/taskloop_simd_ast_print.cpp b/clang/test/OpenMP/taskloop_simd_ast_print.cpp
index 59144f344949..9120d46553a9 100644
--- a/clang/test/OpenMP/taskloop_simd_ast_print.cpp
+++ b/clang/test/OpenMP/taskloop_simd_ast_print.cpp
@@ -76,7 +76,7 @@ int main(int argc, char **argv) {
// CHECK-NEXT: a = 2;
#pragma omp parallel
#ifdef OMP5
-#pragma omp taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e)
+#pragma omp taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e) nontemporal(argc, c, d)
#else
#pragma omp taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e)
#endif // OMP5
@@ -84,7 +84,7 @@ int main(int argc, char **argv) {
for (int j = 0; j < 10; ++j)
foo();
// CHECK-NEXT: #pragma omp parallel
- // OMP50-NEXT: #pragma omp taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e)
+ // OMP50-NEXT: #pragma omp taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e) nontemporal(argc,c,d)
// OMP45-NEXT: #pragma omp taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: for (int j = 0; j < 10; ++j)
diff --git a/clang/test/OpenMP/taskloop_simd_misc_messages.c b/clang/test/OpenMP/taskloop_simd_misc_messages.c
index 1f2087f2d89e..b9a6707d2bfc 100644
--- a/clang/test/OpenMP/taskloop_simd_misc_messages.c
+++ b/clang/test/OpenMP/taskloop_simd_misc_messages.c
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -fsyntax-only -fopenmp -triple x86_64-unknown-unknown -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -triple x86_64-unknown-unknown -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp -triple x86_64-unknown-unknown -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
-// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -triple x86_64-unknown-unknown -verify %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -triple x86_64-unknown-unknown -fopenmp-version=45 -verify=expected,omp45 %s -Wuninitialized
+// RUN: %clang_cc1 -fsyntax-only -fopenmp-simd -triple x86_64-unknown-unknown -fopenmp-version=50 -verify=expected,omp50 %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -383,3 +385,87 @@ void test_loop_messages() {
}
}
+void test_nontemporal() {
+ int i;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp taskloop simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp taskloop simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp taskloop simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 {{expected expression}}
+#pragma omp taskloop simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 {{expected expression}}
+#pragma omp taskloop simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp taskloop simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp taskloop simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp taskloop simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp taskloop simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp taskloop simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp taskloop simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp taskloop simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}}
+#pragma omp taskloop simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}}
+#pragma omp taskloop simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp taskloop simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}}
+#pragma omp taskloop simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp taskloop simd'}}
+#pragma omp taskloop simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp
index 099696142492..51d18ccfd771 100644
--- a/clang/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp
+++ b/clang/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp
@@ -157,7 +157,7 @@ T tmain(T argc) {
// CHECK-NEXT: foo();
#pragma omp target
#ifdef OMP5
-#pragma omp teams distribute parallel for simd if(simd:argc)
+#pragma omp teams distribute parallel for simd if(simd:argc) nontemporal(argc, c, d)
#else
#pragma omp teams distribute parallel for simd
#endif // OMP5
@@ -165,7 +165,7 @@ T tmain(T argc) {
foo();
// CHECK: #pragma omp target
// OMP45-NEXT: #pragma omp teams distribute parallel for simd
-// OMP50-NEXT: #pragma omp teams distribute parallel for simd if(simd: argc)
+// OMP50-NEXT: #pragma omp teams distribute parallel for simd if(simd: argc) nontemporal(argc,c,d)
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
// CHECK-NEXT: foo();
#pragma omp target
diff --git a/clang/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp b/clang/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp
index e01b3f118b32..c043704a3a66 100644
--- a/clang/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -verify=expected,omp45 -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -verify=expected,omp50 -std=c++11 %s -Wuninitialized
-// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 -std=c++11 %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -120,3 +122,104 @@ void test_ordered() {
;
}
+void test_nontemporal() {
+ int i;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp teams distribute parallel for simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp teams distribute parallel for simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp teams distribute parallel for simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 {{expected expression}}
+#pragma omp teams distribute parallel for simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 {{expected '(' for function-style cast or type construction}}
+#pragma omp teams distribute parallel for simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp teams distribute parallel for simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp teams distribute parallel for simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp teams distribute parallel for simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp teams distribute parallel for simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp teams distribute parallel for simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp teams distribute parallel for simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp teams distribute parallel for simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}}
+#pragma omp teams distribute parallel for simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}}
+#pragma omp teams distribute parallel for simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp teams distribute parallel for simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}}
+#pragma omp teams distribute parallel for simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute parallel for simd'}}
+#pragma omp teams distribute parallel for simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/test/OpenMP/teams_distribute_simd_ast_print.cpp b/clang/test/OpenMP/teams_distribute_simd_ast_print.cpp
index e1ed535e75bf..b93cd49984a0 100644
--- a/clang/test/OpenMP/teams_distribute_simd_ast_print.cpp
+++ b/clang/test/OpenMP/teams_distribute_simd_ast_print.cpp
@@ -243,7 +243,7 @@ int main (int argc, char **argv) {
// CHECK-NEXT: e += d + argc;
#pragma omp target
#ifdef OMP5
-#pragma omp teams distribute simd safelen(clen-1) aligned(arr:N+6) if(simd:b)
+#pragma omp teams distribute simd safelen(clen-1) aligned(arr:N+6) if(simd:b) nontemporal(argc, c, d)
#else
#pragma omp teams distribute simd safelen(clen-1) aligned(arr:N+6)
#endif
@@ -251,7 +251,7 @@ int main (int argc, char **argv) {
e += d + argc + arr[k];
// CHECK: #pragma omp target
// OMP45-NEXT: #pragma omp teams distribute simd safelen(clen - 1) aligned(arr: N + 6)
-// OMP50-NEXT: #pragma omp teams distribute simd safelen(clen - 1) aligned(arr: N + 6) if(simd: b)
+// OMP50-NEXT: #pragma omp teams distribute simd safelen(clen - 1) aligned(arr: N + 6) if(simd: b) nontemporal(argc,c,d)
// CHECK-NEXT: for (int k = 0; k < 10; ++k)
// CHECK-NEXT: e += d + argc + arr[k];
return (0);
diff --git a/clang/test/OpenMP/teams_distribute_simd_messages.cpp b/clang/test/OpenMP/teams_distribute_simd_messages.cpp
index 3ec2c874a473..52f8d241599a 100644
--- a/clang/test/OpenMP/teams_distribute_simd_messages.cpp
+++ b/clang/test/OpenMP/teams_distribute_simd_messages.cpp
@@ -1,6 +1,8 @@
-// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -verify=expected,omp45 -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -verify=expected,omp50 -std=c++11 %s -Wuninitialized
-// RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -verify=expected,omp45 -std=c++11 %s -Wuninitialized
+// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -verify=expected,omp50 -std=c++11 %s -Wuninitialized
void xxx(int argc) {
int x; // expected-note {{initialize the variable 'x' to silence this warning}}
@@ -120,3 +122,104 @@ void test_ordered() {
;
}
+void test_nontemporal() {
+ int i;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp teams distribute simd nontemporal(
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 2 {{expected expression}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp teams distribute simd nontemporal(,
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 2 {{expected expression}}
+#pragma omp teams distribute simd nontemporal(, )
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 {{expected expression}}
+#pragma omp teams distribute simd nontemporal()
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 {{expected '(' for function-style cast or type construction}}
+#pragma omp teams distribute simd nontemporal(int)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} omp50-error at +1 {{expected variable name}}
+#pragma omp teams distribute simd nontemporal(0)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 {{use of undeclared identifier 'x'}}
+#pragma omp teams distribute simd nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// expected-error at +2 {{use of undeclared identifier 'x'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 {{use of undeclared identifier 'y'}}
+#pragma omp teams distribute simd nontemporal(x, y)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// expected-error at +3 {{use of undeclared identifier 'x'}}
+// expected-error at +2 {{use of undeclared identifier 'y'}}
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 {{use of undeclared identifier 'z'}}
+#pragma omp teams distribute simd nontemporal(x, y, z)
+ for (i = 0; i < 16; ++i)
+ ;
+
+ int x, y;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}}
+#pragma omp teams distribute simd nontemporal(x :)
+ for (i = 0; i < 16; ++i)
+ ;
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-error at +1 {{expected ')'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}}
+#pragma omp teams distribute simd nontemporal(x :, )
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp50-note at +2 {{defined as nontemporal}}
+// omp45-error at +1 2 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} omp50-error at +1 {{a variable cannot appear in more than one nontemporal clause}}
+#pragma omp teams distribute simd nontemporal(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}}
+#pragma omp teams distribute simd private(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}}
+#pragma omp teams distribute simd nontemporal(x) private(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}} expected-note at +1 {{to match this '('}} expected-error at +1 {{expected ',' or ')' in 'nontemporal' clause}} expected-error at +1 {{expected ')'}}
+#pragma omp teams distribute simd nontemporal(x, y : 0)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}}
+#pragma omp teams distribute simd nontemporal(x) lastprivate(x)
+ for (i = 0; i < 16; ++i)
+ ;
+
+#pragma omp target
+// omp45-error at +1 {{unexpected OpenMP clause 'nontemporal' in directive '#pragma omp teams distribute simd'}}
+#pragma omp teams distribute simd lastprivate(x) nontemporal(x)
+ for (i = 0; i < 16; ++i)
+ ;
+}
+
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 09aa0b25038a..229abece37a4 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -2455,6 +2455,10 @@ void OMPClauseEnqueue::VisitOMPUseDevicePtrClause(const OMPUseDevicePtrClause *C
void OMPClauseEnqueue::VisitOMPIsDevicePtrClause(const OMPIsDevicePtrClause *C) {
VisitOMPClauseList(C);
}
+void OMPClauseEnqueue::VisitOMPNontemporalClause(
+ const OMPNontemporalClause *C) {
+ VisitOMPClauseList(C);
+}
}
void EnqueueVisitor::EnqueueChildren(const OMPClause *S) {
More information about the cfe-commits
mailing list