forked from OSchip/llvm-project
[OPENMP] Parsing/Sema of directive omp parallel for simd
llvm-svn: 218299
This commit is contained in:
parent
caf534ef96
commit
e4e893bb36
|
@ -2213,9 +2213,13 @@ enum CXCursorKind {
|
|||
*/
|
||||
CXCursor_OMPForSimdDirective = 250,
|
||||
|
||||
/** \brief OpenMP parallel for simd directive.
|
||||
*/
|
||||
CXCursor_OMPParallelForSimdDirective = 251,
|
||||
|
||||
/** \brief OpenMP target directive.
|
||||
*/
|
||||
CXCursor_OMPTargetDirective = 251,
|
||||
CXCursor_OMPTargetDirective = 252,
|
||||
|
||||
CXCursor_LastStmt = CXCursor_OMPTargetDirective,
|
||||
|
||||
|
|
|
@ -2318,6 +2318,9 @@ DEF_TRAVERSE_STMT(OMPCriticalDirective, {
|
|||
DEF_TRAVERSE_STMT(OMPParallelForDirective,
|
||||
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
|
||||
|
||||
DEF_TRAVERSE_STMT(OMPParallelForSimdDirective,
|
||||
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
|
||||
|
||||
DEF_TRAVERSE_STMT(OMPParallelSectionsDirective,
|
||||
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
|
||||
|
||||
|
|
|
@ -2340,6 +2340,9 @@ DEF_TRAVERSE_STMT(OMPCriticalDirective, {
|
|||
DEF_TRAVERSE_STMT(OMPParallelForDirective,
|
||||
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
|
||||
|
||||
DEF_TRAVERSE_STMT(OMPParallelForSimdDirective,
|
||||
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
|
||||
|
||||
DEF_TRAVERSE_STMT(OMPParallelSectionsDirective,
|
||||
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
|
||||
|
||||
|
|
|
@ -274,7 +274,8 @@ public:
|
|||
return T->getStmtClass() == OMPSimdDirectiveClass ||
|
||||
T->getStmtClass() == OMPForDirectiveClass ||
|
||||
T->getStmtClass() == OMPForSimdDirectiveClass ||
|
||||
T->getStmtClass() == OMPParallelForDirectiveClass;
|
||||
T->getStmtClass() == OMPParallelForDirectiveClass ||
|
||||
T->getStmtClass() == OMPParallelForSimdDirectiveClass;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -804,6 +805,74 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/// \brief This represents '#pragma omp parallel for simd' directive.
|
||||
///
|
||||
/// \code
|
||||
/// #pragma omp parallel for simd private(a,b) linear(i,j:s) reduction(+:c,d)
|
||||
/// \endcode
|
||||
/// In this example directive '#pragma omp parallel for simd' has clauses
|
||||
/// 'private' with the variables 'a' and 'b', 'linear' with variables 'i', 'j'
|
||||
/// and linear step 's', 'reduction' with operator '+' and variables 'c' and
|
||||
/// 'd'.
|
||||
///
|
||||
class OMPParallelForSimdDirective : public OMPLoopDirective {
|
||||
friend class ASTStmtReader;
|
||||
/// \brief Build directive with the given start and end location.
|
||||
///
|
||||
/// \param StartLoc Starting location of the directive kind.
|
||||
/// \param EndLoc Ending location of the directive.
|
||||
/// \param CollapsedNum Number of collapsed nested loops.
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
OMPParallelForSimdDirective(SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
unsigned CollapsedNum, unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
|
||||
OMPD_parallel_for_simd, StartLoc, EndLoc, CollapsedNum,
|
||||
NumClauses) {}
|
||||
|
||||
/// \brief Build an empty directive.
|
||||
///
|
||||
/// \param CollapsedNum Number of collapsed nested loops.
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
explicit OMPParallelForSimdDirective(unsigned CollapsedNum,
|
||||
unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPParallelForSimdDirectiveClass,
|
||||
OMPD_parallel_for_simd, SourceLocation(),
|
||||
SourceLocation(), CollapsedNum, NumClauses) {}
|
||||
|
||||
public:
|
||||
/// \brief Creates directive with a list of \a Clauses.
|
||||
///
|
||||
/// \param C AST context.
|
||||
/// \param StartLoc Starting location of the directive kind.
|
||||
/// \param EndLoc Ending Location of the directive.
|
||||
/// \param CollapsedNum Number of collapsed loops.
|
||||
/// \param Clauses List of clauses.
|
||||
/// \param AssociatedStmt Statement, associated with the directive.
|
||||
///
|
||||
static OMPParallelForSimdDirective *
|
||||
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
|
||||
Stmt *AssociatedStmt);
|
||||
|
||||
/// \brief Creates an empty directive with the place
|
||||
/// for \a NumClauses clauses.
|
||||
///
|
||||
/// \param C AST context.
|
||||
/// \param CollapsedNum Number of collapsed nested loops.
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
static OMPParallelForSimdDirective *CreateEmpty(const ASTContext &C,
|
||||
unsigned NumClauses,
|
||||
unsigned CollapsedNum,
|
||||
EmptyShell);
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == OMPParallelForSimdDirectiveClass;
|
||||
}
|
||||
};
|
||||
|
||||
/// \brief This represents '#pragma omp parallel sections' directive.
|
||||
///
|
||||
/// \code
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
#ifndef OPENMP_PARALLEL_FOR_CLAUSE
|
||||
# define OPENMP_PARALLEL_FOR_CLAUSE(Name)
|
||||
#endif
|
||||
#ifndef OPENMP_PARALLEL_FOR_SIMD_CLAUSE
|
||||
# define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name)
|
||||
#endif
|
||||
#ifndef OPENMP_PARALLEL_SECTIONS_CLAUSE
|
||||
# define OPENMP_PARALLEL_SECTIONS_CLAUSE(Name)
|
||||
#endif
|
||||
|
@ -83,6 +86,7 @@ OPENMP_DIRECTIVE(ordered)
|
|||
OPENMP_DIRECTIVE(atomic)
|
||||
OPENMP_DIRECTIVE(target)
|
||||
OPENMP_DIRECTIVE_EXT(parallel_for, "parallel for")
|
||||
OPENMP_DIRECTIVE_EXT(parallel_for_simd, "parallel for simd")
|
||||
OPENMP_DIRECTIVE_EXT(parallel_sections, "parallel sections")
|
||||
OPENMP_DIRECTIVE_EXT(for_simd, "for simd")
|
||||
|
||||
|
@ -201,6 +205,23 @@ OPENMP_PARALLEL_FOR_CLAUSE(collapse)
|
|||
OPENMP_PARALLEL_FOR_CLAUSE(schedule)
|
||||
OPENMP_PARALLEL_FOR_CLAUSE(ordered)
|
||||
|
||||
// Clauses allowed for OpenMP directive 'parallel for simd'.
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(if)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(num_threads)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(default)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(proc_bind)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(private)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(firstprivate)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(shared)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(reduction)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(copyin)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(lastprivate)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(collapse)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(schedule)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(safelen)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(linear)
|
||||
OPENMP_PARALLEL_FOR_SIMD_CLAUSE(aligned)
|
||||
|
||||
// Clauses allowed for OpenMP directive 'parallel sections'.
|
||||
OPENMP_PARALLEL_SECTIONS_CLAUSE(if)
|
||||
OPENMP_PARALLEL_SECTIONS_CLAUSE(num_threads)
|
||||
|
@ -244,6 +265,7 @@ OPENMP_TARGET_CLAUSE(if)
|
|||
#undef OPENMP_SECTIONS_CLAUSE
|
||||
#undef OPENMP_PARALLEL_CLAUSE
|
||||
#undef OPENMP_PARALLEL_FOR_CLAUSE
|
||||
#undef OPENMP_PARALLEL_FOR_SIMD_CLAUSE
|
||||
#undef OPENMP_PARALLEL_SECTIONS_CLAUSE
|
||||
#undef OPENMP_TASK_CLAUSE
|
||||
#undef OPENMP_ATOMIC_CLAUSE
|
||||
|
|
|
@ -189,6 +189,7 @@ def OMPSingleDirective : DStmt<OMPExecutableDirective>;
|
|||
def OMPMasterDirective : DStmt<OMPExecutableDirective>;
|
||||
def OMPCriticalDirective : DStmt<OMPExecutableDirective>;
|
||||
def OMPParallelForDirective : DStmt<OMPLoopDirective>;
|
||||
def OMPParallelForSimdDirective : DStmt<OMPLoopDirective>;
|
||||
def OMPParallelSectionsDirective : DStmt<OMPExecutableDirective>;
|
||||
def OMPTaskDirective : DStmt<OMPExecutableDirective>;
|
||||
def OMPTaskyieldDirective : DStmt<OMPExecutableDirective>;
|
||||
|
|
|
@ -7438,6 +7438,12 @@ public:
|
|||
ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
|
||||
SourceLocation EndLoc,
|
||||
llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
|
||||
/// \brief Called on well-formed '\#pragma omp parallel for simd' after
|
||||
/// parsing of the associated statement.
|
||||
StmtResult ActOnOpenMPParallelForSimdDirective(
|
||||
ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
|
||||
SourceLocation EndLoc,
|
||||
llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
|
||||
/// \brief Called on well-formed '\#pragma omp parallel sections' after
|
||||
/// parsing of the associated statement.
|
||||
StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
|
||||
|
|
|
@ -1350,6 +1350,7 @@ namespace clang {
|
|||
STMT_OMP_MASTER_DIRECTIVE,
|
||||
STMT_OMP_CRITICAL_DIRECTIVE,
|
||||
STMT_OMP_PARALLEL_FOR_DIRECTIVE,
|
||||
STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE,
|
||||
STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE,
|
||||
STMT_OMP_TASK_DIRECTIVE,
|
||||
STMT_OMP_TASKYIELD_DIRECTIVE,
|
||||
|
|
|
@ -1627,6 +1627,32 @@ OMPParallelForDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
|
|||
return new (Mem) OMPParallelForDirective(CollapsedNum, NumClauses);
|
||||
}
|
||||
|
||||
OMPParallelForSimdDirective *OMPParallelForSimdDirective::Create(
|
||||
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
|
||||
Stmt *AssociatedStmt) {
|
||||
unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelForSimdDirective),
|
||||
llvm::alignOf<OMPClause *>());
|
||||
void *Mem =
|
||||
C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *));
|
||||
OMPParallelForSimdDirective *Dir = new (Mem) OMPParallelForSimdDirective(
|
||||
StartLoc, EndLoc, CollapsedNum, Clauses.size());
|
||||
Dir->setClauses(Clauses);
|
||||
Dir->setAssociatedStmt(AssociatedStmt);
|
||||
return Dir;
|
||||
}
|
||||
|
||||
OMPParallelForSimdDirective *
|
||||
OMPParallelForSimdDirective::CreateEmpty(const ASTContext &C,
|
||||
unsigned NumClauses,
|
||||
unsigned CollapsedNum, EmptyShell) {
|
||||
unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPParallelForSimdDirective),
|
||||
llvm::alignOf<OMPClause *>());
|
||||
void *Mem =
|
||||
C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *));
|
||||
return new (Mem) OMPParallelForSimdDirective(CollapsedNum, NumClauses);
|
||||
}
|
||||
|
||||
OMPParallelSectionsDirective *OMPParallelSectionsDirective::Create(
|
||||
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt) {
|
||||
|
|
|
@ -876,6 +876,12 @@ void StmtPrinter::VisitOMPParallelForDirective(OMPParallelForDirective *Node) {
|
|||
PrintOMPExecutableDirective(Node);
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitOMPParallelForSimdDirective(
|
||||
OMPParallelForSimdDirective *Node) {
|
||||
Indent() << "#pragma omp parallel for simd ";
|
||||
PrintOMPExecutableDirective(Node);
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitOMPParallelSectionsDirective(
|
||||
OMPParallelSectionsDirective *Node) {
|
||||
Indent() << "#pragma omp parallel sections ";
|
||||
|
|
|
@ -424,6 +424,11 @@ StmtProfiler::VisitOMPParallelForDirective(const OMPParallelForDirective *S) {
|
|||
VisitOMPLoopDirective(S);
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitOMPParallelForSimdDirective(
|
||||
const OMPParallelForSimdDirective *S) {
|
||||
VisitOMPLoopDirective(S);
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitOMPParallelSectionsDirective(
|
||||
const OMPParallelSectionsDirective *S) {
|
||||
VisitOMPExecutableDirective(S);
|
||||
|
|
|
@ -256,6 +256,16 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
|
|||
#define OPENMP_PARALLEL_FOR_CLAUSE(Name) \
|
||||
case OMPC_##Name: \
|
||||
return true;
|
||||
#include "clang/Basic/OpenMPKinds.def"
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case OMPD_parallel_for_simd:
|
||||
switch (CKind) {
|
||||
#define OPENMP_PARALLEL_FOR_SIMD_CLAUSE(Name) \
|
||||
case OMPC_##Name: \
|
||||
return true;
|
||||
#include "clang/Basic/OpenMPKinds.def"
|
||||
default:
|
||||
break;
|
||||
|
@ -319,26 +329,28 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
|
|||
}
|
||||
|
||||
bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
|
||||
return DKind == OMPD_simd || DKind == OMPD_for ||
|
||||
return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
|
||||
DKind == OMPD_parallel_for ||
|
||||
DKind == OMPD_for_simd; // TODO add next directives.
|
||||
DKind == OMPD_parallel_for_simd; // TODO add next directives.
|
||||
}
|
||||
|
||||
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
|
||||
return DKind == OMPD_for || DKind == OMPD_sections || DKind == OMPD_section ||
|
||||
return DKind == OMPD_for || DKind == OMPD_for_simd ||
|
||||
DKind == OMPD_sections || DKind == OMPD_section ||
|
||||
DKind == OMPD_single || DKind == OMPD_parallel_for ||
|
||||
DKind == OMPD_parallel_sections ||
|
||||
DKind == OMPD_for_simd; // TODO add next directives.
|
||||
DKind == OMPD_parallel_for_simd ||
|
||||
DKind == OMPD_parallel_sections; // TODO add next directives.
|
||||
}
|
||||
|
||||
bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) {
|
||||
return DKind == OMPD_parallel || DKind == OMPD_parallel_for ||
|
||||
DKind == OMPD_parallel_for_simd ||
|
||||
DKind == OMPD_parallel_sections; // TODO add next directives.
|
||||
}
|
||||
|
||||
bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
|
||||
return DKind == OMPD_simd ||
|
||||
DKind == OMPD_for_simd; // TODO add next directives.
|
||||
return DKind == OMPD_simd || DKind == OMPD_for_simd ||
|
||||
DKind == OMPD_parallel_for_simd; // TODO add next directives.
|
||||
}
|
||||
|
||||
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
|
||||
|
|
|
@ -206,6 +206,9 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
|
|||
case Stmt::OMPParallelForDirectiveClass:
|
||||
EmitOMPParallelForDirective(cast<OMPParallelForDirective>(*S));
|
||||
break;
|
||||
case Stmt::OMPParallelForSimdDirectiveClass:
|
||||
EmitOMPParallelForSimdDirective(cast<OMPParallelForSimdDirective>(*S));
|
||||
break;
|
||||
case Stmt::OMPParallelSectionsDirectiveClass:
|
||||
EmitOMPParallelSectionsDirective(cast<OMPParallelSectionsDirective>(*S));
|
||||
break;
|
||||
|
|
|
@ -121,6 +121,11 @@ CodeGenFunction::EmitOMPParallelForDirective(const OMPParallelForDirective &) {
|
|||
llvm_unreachable("CodeGen for 'omp parallel for' is not supported yet.");
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitOMPParallelForSimdDirective(
|
||||
const OMPParallelForSimdDirective &) {
|
||||
llvm_unreachable("CodeGen for 'omp parallel for simd' is not supported yet.");
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitOMPParallelSectionsDirective(
|
||||
const OMPParallelSectionsDirective &) {
|
||||
llvm_unreachable("CodeGen for 'omp parallel sections' is not supported yet.");
|
||||
|
|
|
@ -1935,6 +1935,7 @@ public:
|
|||
void EmitOMPMasterDirective(const OMPMasterDirective &S);
|
||||
void EmitOMPCriticalDirective(const OMPCriticalDirective &S);
|
||||
void EmitOMPParallelForDirective(const OMPParallelForDirective &S);
|
||||
void EmitOMPParallelForSimdDirective(const OMPParallelForSimdDirective &S);
|
||||
void EmitOMPParallelSectionsDirective(const OMPParallelSectionsDirective &S);
|
||||
void EmitOMPTaskDirective(const OMPTaskDirective &S);
|
||||
void EmitOMPTaskyieldDirective(const OMPTaskyieldDirective &S);
|
||||
|
|
|
@ -32,6 +32,7 @@ static OpenMPDirectiveKind ParseOpenMPDirectiveKind(Parser &P) {
|
|||
const OpenMPDirectiveKind F[][3] = {
|
||||
{ OMPD_for, OMPD_simd, OMPD_for_simd },
|
||||
{ OMPD_parallel, OMPD_for, OMPD_parallel_for },
|
||||
{ OMPD_parallel_for, OMPD_simd, OMPD_parallel_for_simd },
|
||||
{ OMPD_parallel, OMPD_sections, OMPD_parallel_sections }
|
||||
};
|
||||
auto Tok = P.getCurToken();
|
||||
|
@ -103,6 +104,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
|
|||
case OMPD_ordered:
|
||||
case OMPD_critical:
|
||||
case OMPD_parallel_for:
|
||||
case OMPD_parallel_for_simd:
|
||||
case OMPD_parallel_sections:
|
||||
case OMPD_atomic:
|
||||
case OMPD_target:
|
||||
|
@ -125,7 +127,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
|
|||
/// 'section' | 'single' | 'master' | 'critical' [ '(' <name> ')' ] |
|
||||
/// 'parallel for' | 'parallel sections' | 'task' | 'taskyield' |
|
||||
/// 'barrier' | 'taskwait' | 'flush' | 'ordered' | 'atomic' |
|
||||
/// 'for simd' | 'target' {clause}
|
||||
/// 'for simd' | 'parallel for simd' | 'target' {clause}
|
||||
/// annot_pragma_openmp_end
|
||||
///
|
||||
StmtResult
|
||||
|
@ -189,6 +191,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
|
|||
case OMPD_master:
|
||||
case OMPD_critical:
|
||||
case OMPD_parallel_for:
|
||||
case OMPD_parallel_for_simd:
|
||||
case OMPD_parallel_sections:
|
||||
case OMPD_task:
|
||||
case OMPD_ordered:
|
||||
|
|
|
@ -1068,6 +1068,18 @@ void Sema::ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope) {
|
|||
Params);
|
||||
break;
|
||||
}
|
||||
case OMPD_parallel_for_simd: {
|
||||
QualType KmpInt32Ty = Context.getIntTypeForBitwidth(32, 1);
|
||||
QualType KmpInt32PtrTy = Context.getPointerType(KmpInt32Ty);
|
||||
Sema::CapturedParamNameType Params[] = {
|
||||
std::make_pair(".global_tid.", KmpInt32PtrTy),
|
||||
std::make_pair(".bound_tid.", KmpInt32PtrTy),
|
||||
std::make_pair(StringRef(), QualType()) // __context with shared vars
|
||||
};
|
||||
ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP,
|
||||
Params);
|
||||
break;
|
||||
}
|
||||
case OMPD_parallel_sections: {
|
||||
Sema::CapturedParamNameType Params[] = {
|
||||
std::make_pair(StringRef(), QualType()) // __context with shared vars
|
||||
|
@ -1165,6 +1177,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | parallel | section | + |
|
||||
// | parallel | single | * |
|
||||
// | parallel | parallel for | * |
|
||||
// | parallel |parallel for simd| * |
|
||||
// | parallel |parallel sections| * |
|
||||
// | parallel | task | * |
|
||||
// | parallel | taskyield | * |
|
||||
|
@ -1185,6 +1198,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | for | section | + |
|
||||
// | for | single | + |
|
||||
// | for | parallel for | * |
|
||||
// | for |parallel for simd| * |
|
||||
// | for |parallel sections| * |
|
||||
// | for | task | * |
|
||||
// | for | taskyield | * |
|
||||
|
@ -1205,6 +1219,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | master | section | + |
|
||||
// | master | single | + |
|
||||
// | master | parallel for | * |
|
||||
// | master |parallel for simd| * |
|
||||
// | master |parallel sections| * |
|
||||
// | master | task | * |
|
||||
// | master | taskyield | * |
|
||||
|
@ -1225,6 +1240,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | critical | section | + |
|
||||
// | critical | single | + |
|
||||
// | critical | parallel for | * |
|
||||
// | critical |parallel for simd| * |
|
||||
// | critical |parallel sections| * |
|
||||
// | critical | task | * |
|
||||
// | critical | taskyield | * |
|
||||
|
@ -1244,6 +1260,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | simd | section | |
|
||||
// | simd | single | |
|
||||
// | simd | parallel for | |
|
||||
// | simd |parallel for simd| |
|
||||
// | simd |parallel sections| |
|
||||
// | simd | task | |
|
||||
// | simd | taskyield | |
|
||||
|
@ -1264,6 +1281,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | for simd | section | |
|
||||
// | for simd | single | |
|
||||
// | for simd | parallel for | |
|
||||
// | for simd |parallel for simd| |
|
||||
// | for simd |parallel sections| |
|
||||
// | for simd | task | |
|
||||
// | for simd | taskyield | |
|
||||
|
@ -1274,6 +1292,27 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | for simd | atomic | |
|
||||
// | for simd | target | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | parallel for simd| parallel | |
|
||||
// | parallel for simd| for | |
|
||||
// | parallel for simd| for simd | |
|
||||
// | parallel for simd| master | |
|
||||
// | parallel for simd| critical | |
|
||||
// | parallel for simd| simd | |
|
||||
// | parallel for simd| sections | |
|
||||
// | parallel for simd| section | |
|
||||
// | parallel for simd| single | |
|
||||
// | parallel for simd| parallel for | |
|
||||
// | parallel for simd|parallel for simd| |
|
||||
// | parallel for simd|parallel sections| |
|
||||
// | parallel for simd| task | |
|
||||
// | parallel for simd| taskyield | |
|
||||
// | parallel for simd| barrier | |
|
||||
// | parallel for simd| taskwait | |
|
||||
// | parallel for simd| flush | |
|
||||
// | parallel for simd| ordered | |
|
||||
// | parallel for simd| atomic | |
|
||||
// | parallel for simd| target | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | sections | parallel | * |
|
||||
// | sections | for | + |
|
||||
// | sections | for simd | + |
|
||||
|
@ -1284,6 +1323,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | sections | section | * |
|
||||
// | sections | single | + |
|
||||
// | sections | parallel for | * |
|
||||
// | sections |parallel for simd| * |
|
||||
// | sections |parallel sections| * |
|
||||
// | sections | task | * |
|
||||
// | sections | taskyield | * |
|
||||
|
@ -1304,6 +1344,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | section | section | + |
|
||||
// | section | single | + |
|
||||
// | section | parallel for | * |
|
||||
// | section |parallel for simd| * |
|
||||
// | section |parallel sections| * |
|
||||
// | section | task | * |
|
||||
// | section | taskyield | * |
|
||||
|
@ -1324,6 +1365,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | single | section | + |
|
||||
// | single | single | + |
|
||||
// | single | parallel for | * |
|
||||
// | single |parallel for simd| * |
|
||||
// | single |parallel sections| * |
|
||||
// | single | task | * |
|
||||
// | single | taskyield | * |
|
||||
|
@ -1344,6 +1386,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | parallel for | section | + |
|
||||
// | parallel for | single | + |
|
||||
// | parallel for | parallel for | * |
|
||||
// | parallel for |parallel for simd| * |
|
||||
// | parallel for |parallel sections| * |
|
||||
// | parallel for | task | * |
|
||||
// | parallel for | taskyield | * |
|
||||
|
@ -1364,6 +1407,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | parallel sections| section | * |
|
||||
// | parallel sections| single | + |
|
||||
// | parallel sections| parallel for | * |
|
||||
// | parallel sections|parallel for simd| * |
|
||||
// | parallel sections|parallel sections| * |
|
||||
// | parallel sections| task | * |
|
||||
// | parallel sections| taskyield | * |
|
||||
|
@ -1384,6 +1428,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | task | section | + |
|
||||
// | task | single | + |
|
||||
// | task | parallel for | * |
|
||||
// | task |parallel for simd| * |
|
||||
// | task |parallel sections| * |
|
||||
// | task | task | * |
|
||||
// | task | taskyield | * |
|
||||
|
@ -1404,6 +1449,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | ordered | section | + |
|
||||
// | ordered | single | + |
|
||||
// | ordered | parallel for | * |
|
||||
// | ordered |parallel for simd| * |
|
||||
// | ordered |parallel sections| * |
|
||||
// | ordered | task | * |
|
||||
// | ordered | taskyield | * |
|
||||
|
@ -1424,6 +1470,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | atomic | section | |
|
||||
// | atomic | single | |
|
||||
// | atomic | parallel for | |
|
||||
// | atomic |parallel for simd| |
|
||||
// | atomic |parallel sections| |
|
||||
// | atomic | task | |
|
||||
// | atomic | taskyield | |
|
||||
|
@ -1444,6 +1491,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | target | section | * |
|
||||
// | target | single | * |
|
||||
// | target | parallel for | * |
|
||||
// | target |parallel for simd| * |
|
||||
// | target |parallel sections| * |
|
||||
// | target | task | * |
|
||||
// | target | taskyield | * |
|
||||
|
@ -1648,6 +1696,10 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind,
|
|||
Res = ActOnOpenMPParallelForDirective(ClausesWithImplicit, AStmt, StartLoc,
|
||||
EndLoc, VarsWithInheritedDSA);
|
||||
break;
|
||||
case OMPD_parallel_for_simd:
|
||||
Res = ActOnOpenMPParallelForSimdDirective(
|
||||
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
|
||||
break;
|
||||
case OMPD_parallel_sections:
|
||||
Res = ActOnOpenMPParallelSectionsDirective(ClausesWithImplicit, AStmt,
|
||||
StartLoc, EndLoc);
|
||||
|
@ -2427,6 +2479,31 @@ StmtResult Sema::ActOnOpenMPParallelForDirective(
|
|||
NestedLoopCount, Clauses, AStmt);
|
||||
}
|
||||
|
||||
StmtResult Sema::ActOnOpenMPParallelForSimdDirective(
|
||||
ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
|
||||
SourceLocation EndLoc,
|
||||
llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA) {
|
||||
assert(AStmt && isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
||||
CapturedStmt *CS = cast<CapturedStmt>(AStmt);
|
||||
// 1.2.2 OpenMP Language Terminology
|
||||
// Structured block - An executable statement with a single entry at the
|
||||
// top and a single exit at the bottom.
|
||||
// The point of exit cannot be a branch out of the structured block.
|
||||
// longjmp() and throw() must not violate the entry/exit criteria.
|
||||
CS->getCapturedDecl()->setNothrow();
|
||||
|
||||
// In presence of clause 'collapse', it will define the nested loops number.
|
||||
unsigned NestedLoopCount =
|
||||
CheckOpenMPLoop(OMPD_parallel_for_simd, GetCollapseNumberExpr(Clauses),
|
||||
AStmt, *this, *DSAStack, VarsWithImplicitDSA);
|
||||
if (NestedLoopCount == 0)
|
||||
return StmtError();
|
||||
|
||||
getCurFunction()->setHasBranchProtectedScope();
|
||||
return OMPParallelForSimdDirective::Create(Context, StartLoc, EndLoc,
|
||||
NestedLoopCount, Clauses, AStmt);
|
||||
}
|
||||
|
||||
StmtResult
|
||||
Sema::ActOnOpenMPParallelSectionsDirective(ArrayRef<OMPClause *> Clauses,
|
||||
Stmt *AStmt, SourceLocation StartLoc,
|
||||
|
|
|
@ -6575,6 +6575,17 @@ StmtResult TreeTransform<Derived>::TransformOMPParallelForDirective(
|
|||
return Res;
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
StmtResult TreeTransform<Derived>::TransformOMPParallelForSimdDirective(
|
||||
OMPParallelForSimdDirective *D) {
|
||||
DeclarationNameInfo DirName;
|
||||
getDerived().getSema().StartOpenMPDSABlock(OMPD_parallel_for_simd, DirName,
|
||||
nullptr, D->getLocStart());
|
||||
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
|
||||
getDerived().getSema().EndOpenMPDSABlock(Res.get());
|
||||
return Res;
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
StmtResult TreeTransform<Derived>::TransformOMPParallelSectionsDirective(
|
||||
OMPParallelSectionsDirective *D) {
|
||||
|
|
|
@ -2023,6 +2023,11 @@ void ASTStmtReader::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
|
|||
VisitOMPLoopDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPParallelForSimdDirective(
|
||||
OMPParallelForSimdDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPParallelSectionsDirective(
|
||||
OMPParallelSectionsDirective *D) {
|
||||
VisitStmt(D);
|
||||
|
@ -2615,6 +2620,14 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
|||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPParallelForSimdDirective::CreateEmpty(Context, NumClauses,
|
||||
CollapsedNum, Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_PARALLEL_SECTIONS_DIRECTIVE:
|
||||
S = OMPParallelSectionsDirective::CreateEmpty(
|
||||
Context, Record[ASTStmtReader::NumStmtFields], Empty);
|
||||
|
|
|
@ -1909,6 +1909,12 @@ void ASTStmtWriter::VisitOMPParallelForDirective(OMPParallelForDirective *D) {
|
|||
Code = serialization::STMT_OMP_PARALLEL_FOR_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPParallelForSimdDirective(
|
||||
OMPParallelForSimdDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Code = serialization::STMT_OMP_PARALLEL_FOR_SIMD_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPParallelSectionsDirective(
|
||||
OMPParallelSectionsDirective *D) {
|
||||
VisitStmt(D);
|
||||
|
|
|
@ -808,6 +808,7 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred,
|
|||
case Stmt::OMPMasterDirectiveClass:
|
||||
case Stmt::OMPCriticalDirectiveClass:
|
||||
case Stmt::OMPParallelForDirectiveClass:
|
||||
case Stmt::OMPParallelForSimdDirectiveClass:
|
||||
case Stmt::OMPParallelSectionsDirectiveClass:
|
||||
case Stmt::OMPTaskDirectiveClass:
|
||||
case Stmt::OMPTaskyieldDirectiveClass:
|
||||
|
|
|
@ -47,6 +47,10 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -160,6 +164,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
|
@ -294,6 +304,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -415,6 +431,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
|
@ -565,6 +587,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -718,6 +746,15 @@ void foo() {
|
|||
{
|
||||
#pragma omp section
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp section
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -868,6 +905,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp single
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp single
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -997,6 +1040,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp master
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp master
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -1126,6 +1175,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp critical
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp critical
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -1279,6 +1334,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -1332,6 +1393,156 @@ void foo() {
|
|||
++a;
|
||||
}
|
||||
|
||||
// PARALLEL FOR SIMD DIRECTIVE
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
#pragma omp single
|
||||
{
|
||||
bar();
|
||||
}
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp sections
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
++a;
|
||||
}
|
||||
|
||||
// PARALLEL SECTIONS DIRECTIVE
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
|
@ -1423,6 +1634,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -1505,6 +1722,10 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp task
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp task
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -1615,12 +1836,28 @@ void foo() {
|
|||
}
|
||||
#pragma omp ordered
|
||||
{
|
||||
#pragma omp parallel for simd ordered //expected-error {{unexpected OpenMP clause 'ordered' in directive '#pragma omp parallel for simd'}}
|
||||
for (int j = 0; j < 10; ++j) {
|
||||
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma omp ordered
|
||||
{
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp ordered
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp ordered
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -1748,6 +1985,13 @@ void foo() {
|
|||
#pragma omp atomic
|
||||
// expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
|
||||
{
|
||||
#pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp atomic
|
||||
// expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
|
||||
{
|
||||
#pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
|
||||
{
|
||||
bar();
|
||||
|
@ -1849,6 +2093,10 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp target
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp target
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -1939,6 +2187,10 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -2045,6 +2297,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
|
@ -2169,6 +2427,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -2283,6 +2547,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
|
@ -2407,6 +2677,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -2561,6 +2837,15 @@ void foo() {
|
|||
{
|
||||
#pragma omp section
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp section
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -2705,6 +2990,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp single
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp single
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -2834,6 +3125,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp master
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp master
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -2963,6 +3260,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp critical
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp critical
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -3121,6 +3424,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -3174,6 +3483,156 @@ void foo() {
|
|||
++a;
|
||||
}
|
||||
|
||||
// PARALLEL FOR SIMD DIRECTIVE
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp for simd // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp section // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp single // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp master // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp critical // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
#pragma omp single
|
||||
{
|
||||
bar();
|
||||
}
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp sections
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd// expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp task // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp taskyield // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp barrier // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp taskwait // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp flush // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp ordered // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp target // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
++a;
|
||||
}
|
||||
|
||||
// PARALLEL SECTIONS DIRECTIVE
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
|
@ -3261,6 +3720,12 @@ void foo() {
|
|||
}
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -3342,6 +3807,10 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp task
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp task
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
@ -3466,6 +3935,13 @@ void foo() {
|
|||
#pragma omp atomic
|
||||
// expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
|
||||
{
|
||||
#pragma omp parallel for simd // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp atomic
|
||||
// expected-error@+1 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
|
||||
{
|
||||
#pragma omp parallel sections // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
|
||||
{
|
||||
bar();
|
||||
|
@ -3567,6 +4043,10 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp target
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp target
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
|
|
|
@ -0,0 +1,201 @@
|
|||
// RUN: %clang_cc1 -x c++ -std=c++11 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
struct B {
|
||||
static int ib[20]; // expected-note 0 {{'B::ib' declared here}}
|
||||
static constexpr int bfoo() { return 8; }
|
||||
};
|
||||
namespace X {
|
||||
B x; // expected-note {{'x' defined here}}
|
||||
};
|
||||
constexpr int bfoo() { return 4; }
|
||||
|
||||
int **z;
|
||||
const int C1 = 1;
|
||||
const int C2 = 2;
|
||||
void test_aligned_colons(int *&rp)
|
||||
{
|
||||
int *B = 0;
|
||||
#pragma omp parallel for simd aligned(B:bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'}}
|
||||
#pragma omp parallel for simd aligned(B::ib:B:bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd aligned(B:B::bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'?}}
|
||||
#pragma omp parallel for simd aligned(z:B:bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd aligned(B:B::bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+2 {{integral constant expression must have integral or unscoped enumeration type, not 'int **'}}
|
||||
// expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'B'}}
|
||||
#pragma omp parallel for simd aligned(X::x : ::z)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+1 {{integral constant expression must have integral or unscoped enumeration type, not 'B'}}
|
||||
#pragma omp parallel for simd aligned(B,rp,::z: X::x)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd aligned(::z)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+1 {{expected variable name}}
|
||||
#pragma omp parallel for simd aligned(B::bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd aligned(B::ib,B:C1+C2)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
}
|
||||
|
||||
// expected-note@+1 {{'num' defined here}}
|
||||
template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
N i;
|
||||
T sum = (T)0;
|
||||
T ind2 = - num * L;
|
||||
// Negative number is passed as L.
|
||||
// expected-error@+1 {{argument to 'aligned' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd aligned(arr:L)
|
||||
for (i = 0; i < num; ++i) {
|
||||
T cur = arr[(int)ind2];
|
||||
ind2 += L;
|
||||
sum += cur;
|
||||
}
|
||||
// expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
|
||||
#pragma omp parallel for simd aligned(num:4)
|
||||
for (i = 0; i < num; ++i);
|
||||
return T();
|
||||
}
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int *ind2 = 0;
|
||||
// expected-error@+1 {{argument to 'aligned' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd aligned(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct S1; // expected-note 2 {{declared here}}
|
||||
extern S1 a; // expected-note {{'a' declared here}}
|
||||
class S2 {
|
||||
mutable int a;
|
||||
public:
|
||||
S2():a(0) { }
|
||||
};
|
||||
const S2 b; // expected-note 1 {{'b' defined here}}
|
||||
const S2 ba[5];
|
||||
class S3 {
|
||||
int a;
|
||||
public:
|
||||
S3():a(0) { }
|
||||
};
|
||||
const S3 ca[5];
|
||||
class S4 {
|
||||
int a;
|
||||
S4();
|
||||
public:
|
||||
S4(int v):a(v) { }
|
||||
};
|
||||
class S5 {
|
||||
int a;
|
||||
S5():a(0) {}
|
||||
public:
|
||||
S5(int v):a(v) { }
|
||||
};
|
||||
|
||||
S3 h; // expected-note 2 {{'h' defined here}}
|
||||
#pragma omp threadprivate(h)
|
||||
|
||||
template<class I, class C> int foomain(I argc, C **argv) {
|
||||
I e(argc);
|
||||
I g(argc);
|
||||
int i; // expected-note {{declared here}} expected-note {{'i' defined here}}
|
||||
// expected-note@+2 {{declared here}}
|
||||
// expected-note@+1 {{reference to 'i' is not a constant expression}}
|
||||
int &j = i;
|
||||
#pragma omp parallel for simd aligned // expected-error {{expected '(' after 'aligned'}}
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned () // expected-error {{expected expression}}
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (argc : 5)
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (argv[1]) // expected-error {{expected variable name}}
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned(e, g)
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S3'}}
|
||||
#pragma omp parallel for simd aligned(h)
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
|
||||
#pragma omp parallel for simd aligned(i)
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel
|
||||
{
|
||||
int *v = 0;
|
||||
I i;
|
||||
#pragma omp parallel for simd aligned(v:16)
|
||||
for (I k = 0; k < argc; ++k) { i = k; v += 2; }
|
||||
}
|
||||
float *f;
|
||||
#pragma omp parallel for simd aligned(f)
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
int v = 0;
|
||||
// expected-note@+2 {{initializer of 'j' is not a constant expression}}
|
||||
// expected-error@+1 {{expression is not an integral constant expression}}
|
||||
#pragma omp parallel for simd aligned(f:j)
|
||||
for (I k = 0; k < argc; ++k) { ++k; v += j; }
|
||||
#pragma omp parallel for simd aligned(f)
|
||||
for (I k = 0; k < argc; ++k) ++k;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// expected-note@+1 2 {{'argc' defined here}}
|
||||
int main(int argc, char **argv) {
|
||||
double darr[100];
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
|
||||
test_template<-4>(darr, 4);
|
||||
test_warn<4>(); // ok
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}}
|
||||
test_warn<0>();
|
||||
|
||||
int i;
|
||||
int &j = i;
|
||||
#pragma omp parallel for simd aligned // expected-error {{expected '(' after 'aligned'}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned () // expected-error {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (argv // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
|
||||
#pragma omp parallel for simd aligned (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}}
|
||||
#pragma omp parallel for simd aligned (argc)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+2 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S1'}}
|
||||
// expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S2'}}
|
||||
#pragma omp parallel for simd aligned (a, b)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd aligned (argv[1]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'S3'}}
|
||||
#pragma omp parallel for simd aligned(h)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
int *pargc = &argc;
|
||||
foomain<int*,char>(pargc,argv);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ast-print %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -fopenmp=libiomp5 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
||||
// expected-no-diagnostics
|
||||
|
||||
#ifndef HEADER
|
||||
#define HEADER
|
||||
|
||||
void foo() {}
|
||||
int g_ind = 1;
|
||||
template<class T, class N> T reduct(T* arr, N num) {
|
||||
N i;
|
||||
N ind;
|
||||
N myind;
|
||||
T sum = (T)0;
|
||||
// CHECK: T sum = (T)0;
|
||||
#pragma omp parallel for simd private(myind, g_ind), linear(ind), aligned(arr)
|
||||
// CHECK-NEXT: #pragma omp parallel for simd private(myind,g_ind) linear(ind) aligned(arr)
|
||||
for (i = 0; i < num; ++i) {
|
||||
myind = ind;
|
||||
T cur = arr[myind];
|
||||
ind += g_ind;
|
||||
sum += cur;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T> struct S {
|
||||
S(const T &a)
|
||||
:m_a(a)
|
||||
{}
|
||||
T result(T *v) const {
|
||||
T res;
|
||||
T val;
|
||||
T lin = 0;
|
||||
// CHECK: T res;
|
||||
// CHECK: T val;
|
||||
// CHECK: T lin = 0;
|
||||
#pragma omp parallel for simd private(val) safelen(7) linear(lin : -5) lastprivate(res)
|
||||
// CHECK-NEXT: #pragma omp parallel for simd private(val) safelen(7) linear(lin: -5) lastprivate(res)
|
||||
for (T i = 7; i < m_a; ++i) {
|
||||
val = v[i-7] + m_a;
|
||||
res = val;
|
||||
lin -= 5;
|
||||
}
|
||||
const T clen = 3;
|
||||
// CHECK: T clen = 3;
|
||||
#pragma omp parallel for simd safelen(clen-1)
|
||||
// CHECK-NEXT: #pragma omp parallel for simd safelen(clen - 1)
|
||||
for(T i = clen+2; i < 20; ++i) {
|
||||
// CHECK-NEXT: for (T i = clen + 2; i < 20; ++i) {
|
||||
v[i] = v[v-clen] + 1;
|
||||
// CHECK-NEXT: v[i] = v[v - clen] + 1;
|
||||
}
|
||||
// CHECK-NEXT: }
|
||||
return res;
|
||||
}
|
||||
~S()
|
||||
{}
|
||||
T m_a;
|
||||
};
|
||||
|
||||
template<int LEN> struct S2 {
|
||||
static void func(int n, float *a, float *b, float *c) {
|
||||
int k1 = 0, k2 = 0;
|
||||
#pragma omp parallel for simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN)
|
||||
for(int i = 0; i < n; i++) {
|
||||
c[i] = a[i] + b[i];
|
||||
c[k1] = a[k1] + b[k1];
|
||||
c[k2] = a[k2] + b[k2];
|
||||
k1 = k1 + LEN;
|
||||
k2 = k2 + LEN;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// S2<4>::func is called below in main.
|
||||
// CHECK: template <int LEN = 4> struct S2 {
|
||||
// CHECK-NEXT: static void func(int n, float *a, float *b, float *c) {
|
||||
// CHECK-NEXT: int k1 = 0, k2 = 0;
|
||||
// CHECK-NEXT: #pragma omp parallel for simd safelen(4) linear(k1,k2: 4) aligned(a: 4)
|
||||
// CHECK-NEXT: for (int i = 0; i < n; i++) {
|
||||
// CHECK-NEXT: c[i] = a[i] + b[i];
|
||||
// CHECK-NEXT: c[k1] = a[k1] + b[k1];
|
||||
// CHECK-NEXT: c[k2] = a[k2] + b[k2];
|
||||
// CHECK-NEXT: k1 = k1 + 4;
|
||||
// CHECK-NEXT: k2 = k2 + 4;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: }
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
int b = argc, c, d, e, f, g;
|
||||
int k1=0,k2=0;
|
||||
static int *a;
|
||||
// CHECK: static int *a;
|
||||
#pragma omp parallel for simd
|
||||
// CHECK-NEXT: #pragma omp parallel for simd
|
||||
for (int i=0; i < 2; ++i)*a=2;
|
||||
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
|
||||
// CHECK-NEXT: *a = 2;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4) ,firstprivate( g )
|
||||
for (int i = 0; i < 10; ++i)
|
||||
for (int j = 0; j < 10; ++j) {foo(); k1 += 8; k2 += 8;}
|
||||
// CHECK-NEXT: #pragma omp parallel
|
||||
// CHECK-NEXT: #pragma omp parallel for simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4) firstprivate(g)
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: for (int j = 0; j < 10; ++j) {
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: k1 += 8;
|
||||
// CHECK-NEXT: k2 += 8;
|
||||
// CHECK-NEXT: }
|
||||
for (int i = 0; i < 10; ++i)foo();
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: foo();
|
||||
const int CLEN = 4;
|
||||
// CHECK-NEXT: const int CLEN = 4;
|
||||
#pragma omp parallel for simd aligned(a:CLEN) linear(a:CLEN) safelen(CLEN) collapse( 1 )
|
||||
// CHECK-NEXT: #pragma omp parallel for simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1)
|
||||
for (int i = 0; i < 10; ++i)foo();
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: foo();
|
||||
|
||||
float arr[16];
|
||||
S2<4>::func(0,arr,arr,arr);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,83 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}}
|
||||
|
||||
template <class T, typename S, int N, int ST> // expected-note {{declared here}}
|
||||
T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
|
||||
#pragma omp parallel for simd collapse // expected-error {{expected '(' after 'collapse'}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd collapse () // expected-error {{expected expression}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
|
||||
// expected-error@+2 2 {{expression is not an integral constant expression}}
|
||||
// expected-note@+1 2 {{read of non-const variable 'argc' is not allowed in a constant expression}}
|
||||
#pragma omp parallel for simd collapse (argc
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+1 2 {{argument to 'collapse' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd collapse (ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd collapse (1)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
// expected-error@+3 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'collapse' clause}}
|
||||
// expected-error@+2 2 {{argument to 'collapse' clause must be a positive integer value}}
|
||||
// expected-error@+1 2 {{expression is not an integral constant expression}}
|
||||
#pragma omp parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd collapse (S) // expected-error {{'S' does not refer to a value}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+1 2 {{expression is not an integral constant expression}}
|
||||
#pragma omp parallel for simd collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd collapse (1)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd collapse (N) // expected-error {{argument to 'collapse' clause must be a positive integer value}}
|
||||
for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd collapse (2) // expected-note {{as specified in 'collapse' clause}}
|
||||
foo(); // expected-error {{expected 2 for loops after '#pragma omp parallel for simd'}}
|
||||
return argc;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp parallel for simd collapse // expected-error {{expected '(' after 'collapse'}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd collapse () // expected-error {{expected expression}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd collapse (4 // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{as specified in 'collapse' clause}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel for simd collapse (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}} expected-note {{as specified in 'collapse' clause}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel for simd collapse (foobool(1) > 0 ? 1 : 2) // expected-error {{expression is not an integral constant expression}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+3 {{expression is not an integral constant expression}}
|
||||
// expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'collapse' clause}}
|
||||
// expected-error@+1 2 {{argument to 'collapse' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5)
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd collapse (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+1 {{expression is not an integral constant expression}}
|
||||
#pragma omp parallel for simd collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+3 {{statement after '#pragma omp parallel for simd' must be a for loop}}
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
|
||||
#pragma omp parallel for simd collapse(collapse(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
|
||||
foo();
|
||||
#pragma omp parallel for simd collapse (2) // expected-note {{as specified in 'collapse' clause}}
|
||||
foo(); // expected-error {{expected 2 for loops after '#pragma omp parallel for simd'}}
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
|
||||
return tmain<int, char, 1, 0>(argc, argv);
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -o - %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}}
|
||||
class S2 {
|
||||
mutable int a;
|
||||
|
||||
public:
|
||||
S2() : a(0) {}
|
||||
S2 &operator=(S2 &s2) { return *this; }
|
||||
};
|
||||
class S3 {
|
||||
int a;
|
||||
|
||||
public:
|
||||
S3() : a(0) {}
|
||||
S3 &operator=(S3 &s3) { return *this; }
|
||||
};
|
||||
class S4 { // expected-note {{'S4' declared here}}
|
||||
int a;
|
||||
S4();
|
||||
S4 &operator=(const S4 &s4);
|
||||
|
||||
public:
|
||||
S4(int v) : a(v) {}
|
||||
};
|
||||
class S5 { // expected-note {{'S5' declared here}}
|
||||
int a;
|
||||
S5() : a(0) {}
|
||||
S5 &operator=(const S5 &s5) { return *this; }
|
||||
|
||||
public:
|
||||
S5(int v) : a(v) {}
|
||||
};
|
||||
template <class T>
|
||||
class ST {
|
||||
public:
|
||||
static T s;
|
||||
};
|
||||
|
||||
S2 k;
|
||||
S3 h;
|
||||
S4 l(3); // expected-note {{'l' defined here}}
|
||||
S5 m(4); // expected-note {{'m' defined here}}
|
||||
#pragma omp threadprivate(h, k, l, m)
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp parallel for simd copyin // expected-error {{expected '(' after 'copyin'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin() // expected-error {{expected expression}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(k // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(h, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(l) // expected-error {{copyin variable must have an accessible, unambiguous copy assignment operator}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(argv[1]) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(i) // expected-error {{copyin variable must be threadprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(m) // expected-error {{copyin variable must have an accessible, unambiguous copy assignment operator}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd copyin(ST < int > ::s) // expected-error {{copyin variable must be threadprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -o - %s
|
||||
|
||||
void foo();
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp parallel for simd default // expected-error {{expected '(' after 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
#pragma omp parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'default' clause}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
#pragma omp parallel for simd default(none)
|
||||
for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
foo();
|
||||
|
||||
#pragma omp parallel default(none)
|
||||
#pragma omp parallel for simd default(shared)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,250 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
|
||||
extern S1 a;
|
||||
class S2 {
|
||||
mutable int a;
|
||||
|
||||
public:
|
||||
S2() : a(0) {}
|
||||
S2(S2 &s2) : a(s2.a) {}
|
||||
static float S2s;
|
||||
static const float S2sc;
|
||||
};
|
||||
const float S2::S2sc = 0;
|
||||
const S2 b;
|
||||
const S2 ba[5];
|
||||
class S3 {
|
||||
int a;
|
||||
S3 &operator=(const S3 &s3);
|
||||
|
||||
public:
|
||||
S3() : a(0) {}
|
||||
S3(S3 &s3) : a(s3.a) {}
|
||||
};
|
||||
const S3 c;
|
||||
const S3 ca[5];
|
||||
extern const int f;
|
||||
class S4 { // expected-note 2 {{'S4' declared here}}
|
||||
int a;
|
||||
S4();
|
||||
S4(const S4 &s4);
|
||||
|
||||
public:
|
||||
S4(int v) : a(v) {}
|
||||
};
|
||||
class S5 { // expected-note 4 {{'S5' declared here}}
|
||||
int a;
|
||||
S5(const S5 &s5) : a(s5.a) {}
|
||||
|
||||
public:
|
||||
S5() : a(0) {}
|
||||
S5(int v) : a(v) {}
|
||||
};
|
||||
class S6 {
|
||||
int a;
|
||||
S6() : a(0) {}
|
||||
|
||||
public:
|
||||
S6(const S6 &s6) : a(s6.a) {}
|
||||
S6(int v) : a(v) {}
|
||||
};
|
||||
|
||||
S3 h;
|
||||
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
|
||||
|
||||
template <class I, class C>
|
||||
int foomain(int argc, char **argv) {
|
||||
I e(4); // expected-note {{'e' defined here}}
|
||||
C g(5); // expected-note 2 {{'g' defined here}}
|
||||
int i;
|
||||
int &j = i; // expected-note {{'j' defined here}}
|
||||
#pragma omp parallel for simd firstprivate // expected-error {{expected '(' after 'firstprivate'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate() // expected-error {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(argc)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(argv[1]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd linear(i)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
{
|
||||
int v = 0;
|
||||
int i;
|
||||
#pragma omp parallel for simd firstprivate(i)
|
||||
for (int k = 0; k < argc; ++k) {
|
||||
i = k;
|
||||
v += i;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel shared(i)
|
||||
#pragma omp parallel private(i)
|
||||
#pragma omp parallel for simd firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd firstprivate(i)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel private(i)
|
||||
#pragma omp parallel for simd firstprivate(i) // expected-note {{defined as firstprivate}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be firstprivate, predetermined as linear}}
|
||||
foo();
|
||||
#pragma omp parallel reduction(+ : i)
|
||||
#pragma omp parallel for simd firstprivate(i) // expected-note {{defined as firstprivate}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be firstprivate, predetermined as linear}}
|
||||
foo();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const int d = 5;
|
||||
const int da[5] = {0};
|
||||
S4 e(4); // expected-note {{'e' defined here}}
|
||||
S5 g(5); // expected-note 2 {{'g' defined here}}
|
||||
S3 m;
|
||||
S6 n(2);
|
||||
int i;
|
||||
int &j = i; // expected-note {{'j' defined here}}
|
||||
#pragma omp parallel for simd firstprivate // expected-error {{expected '(' after 'firstprivate'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate() // expected-error {{expected expression}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(argc)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(argv[1]) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(2 * 2) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(ba) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(ca) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(da) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
int xa;
|
||||
#pragma omp parallel for simd firstprivate(xa) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(S2::S2s) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(S2::S2sc) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd safelen(5)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(m) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd private(xa), firstprivate(xa) // expected-error {{private variable cannot be firstprivate}} expected-note {{defined as private}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(i) // expected-note {{defined as firstprivate}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be firstprivate, predetermined as linear}}
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(xa) // OK: may be firstprivate
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(n) firstprivate(n) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel
|
||||
{
|
||||
int v = 0;
|
||||
int i;
|
||||
#pragma omp parallel for simd firstprivate(i)
|
||||
for (int k = 0; k < argc; ++k) {
|
||||
i = k;
|
||||
v += i;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel private(i)
|
||||
#pragma omp parallel for simd firstprivate(i) // expected-note {{defined as firstprivate}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be firstprivate, predetermined as linear}}
|
||||
foo();
|
||||
#pragma omp parallel reduction(+ : i)
|
||||
#pragma omp parallel for simd firstprivate(i) // expected-note {{defined as firstprivate}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be firstprivate, predetermined as linear}}
|
||||
foo();
|
||||
|
||||
return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}}
|
||||
|
||||
template <class T, class S> // expected-note {{declared here}}
|
||||
int tmain(T argc, S **argv) {
|
||||
T i;
|
||||
#pragma omp parallel for simd if // expected-error {{expected '(' after 'if'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if () // expected-error {{expected expression}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argc > 0 ? argv[1] : argv[2])
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (S) // expected-error {{'S' does not refer to a value}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if(argc)
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp parallel for simd if // expected-error {{expected '(' after 'if'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if () // expected-error {{expected expression}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argc > 0 ? argv[1] : argv[2])
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'if' clause}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
|
||||
return tmain(argc, argv);
|
||||
}
|
|
@ -0,0 +1,226 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
|
||||
extern S1 a;
|
||||
class S2 {
|
||||
mutable int a;
|
||||
|
||||
public:
|
||||
S2() : a(0) {}
|
||||
S2(S2 &s2) : a(s2.a) {}
|
||||
static float S2s; // expected-note {{static data member is predetermined as shared}}
|
||||
static const float S2sc;
|
||||
};
|
||||
const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
|
||||
const S2 b;
|
||||
const S2 ba[5];
|
||||
class S3 { // expected-note 2 {{'S3' declared here}}
|
||||
int a;
|
||||
S3 &operator=(const S3 &s3);
|
||||
|
||||
public:
|
||||
S3() : a(0) {}
|
||||
S3(S3 &s3) : a(s3.a) {}
|
||||
};
|
||||
const S3 c; // expected-note {{global variable is predetermined as shared}}
|
||||
const S3 ca[5]; // expected-note {{global variable is predetermined as shared}}
|
||||
extern const int f; // expected-note {{global variable is predetermined as shared}}
|
||||
class S4 { // expected-note 3 {{'S4' declared here}}
|
||||
int a;
|
||||
S4();
|
||||
S4(const S4 &s4);
|
||||
|
||||
public:
|
||||
S4(int v) : a(v) {}
|
||||
};
|
||||
class S5 { // expected-note {{'S5' declared here}}
|
||||
int a;
|
||||
S5() : a(0) {}
|
||||
|
||||
public:
|
||||
S5(const S5 &s5) : a(s5.a) {}
|
||||
S5(int v) : a(v) {}
|
||||
};
|
||||
class S6 {
|
||||
int a;
|
||||
S6() : a(0) {}
|
||||
|
||||
public:
|
||||
S6(const S6 &s6) : a(s6.a) {}
|
||||
S6(int v) : a(v) {}
|
||||
};
|
||||
|
||||
S3 h;
|
||||
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
|
||||
|
||||
template <class I, class C>
|
||||
int foomain(int argc, char **argv) {
|
||||
I e(4); // expected-note {{'e' defined here}}
|
||||
I g(5); // expected-note {{'g' defined here}}
|
||||
int i;
|
||||
int &j = i; // expected-note {{'j' defined here}}
|
||||
#pragma omp parallel for simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate() // expected-error {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(argc)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(a, b) // expected-error {{lastprivate variable with incomplete type 'S1'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(argv[1]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd linear(i)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel
|
||||
{
|
||||
int v = 0;
|
||||
int i;
|
||||
#pragma omp parallel for simd lastprivate(i)
|
||||
for (int k = 0; k < argc; ++k) {
|
||||
i = k;
|
||||
v += i;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel shared(i)
|
||||
#pragma omp parallel private(i)
|
||||
#pragma omp parallel for simd lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd lastprivate(i)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
|
||||
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
|
||||
S4 e(4); // expected-note {{'e' defined here}}
|
||||
S5 g(5); // expected-note {{'g' defined here}}
|
||||
S3 m; // expected-note 2 {{'m' defined here}}
|
||||
S6 n(2);
|
||||
int i;
|
||||
int &j = i; // expected-note {{'j' defined here}}
|
||||
#pragma omp parallel for simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate() // expected-error {{expected expression}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(argc)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(a, b, c, d, f) // expected-error {{lastprivate variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be lastprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(argv[1]) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(2 * 2) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(ba)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(ca) // expected-error {{shared variable cannot be lastprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(da) // expected-error {{shared variable cannot be lastprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
int xa;
|
||||
#pragma omp parallel for simd lastprivate(xa) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd safelen(5)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd private(xa), lastprivate(xa) // expected-error {{private variable cannot be lastprivate}} expected-note {{defined as private}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(i) // expected-note {{defined as lastprivate}}
|
||||
for (i = 0; i < argc; ++i) // expected-error {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be lastprivate, predetermined as linear}}
|
||||
foo();
|
||||
#pragma omp parallel private(xa)
|
||||
#pragma omp parallel for simd lastprivate(xa)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel reduction(+ : xa)
|
||||
#pragma omp parallel for simd lastprivate(xa)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(j) // expected-error {{arguments of OpenMP clause 'lastprivate' cannot be of reference type}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd firstprivate(m) lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd lastprivate(n) firstprivate(n) // OK
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}}
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
namespace X {
|
||||
int x;
|
||||
};
|
||||
|
||||
struct B {
|
||||
static int ib; // expected-note {{'B::ib' declared here}}
|
||||
static int bfoo() { return 8; }
|
||||
};
|
||||
|
||||
int bfoo() { return 4; }
|
||||
|
||||
int z;
|
||||
const int C1 = 1;
|
||||
const int C2 = 2;
|
||||
void test_linear_colons()
|
||||
{
|
||||
int B = 0;
|
||||
#pragma omp parallel for simd linear(B:bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'}}
|
||||
#pragma omp parallel for simd linear(B::ib:B:bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+1 {{use of undeclared identifier 'ib'; did you mean 'B::ib'}}
|
||||
#pragma omp parallel for simd linear(B:ib)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'?}}
|
||||
#pragma omp parallel for simd linear(z:B:ib)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd linear(B:B::bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd linear(X::x : ::z)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd linear(B,::z, X::x)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd linear(::z)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
// expected-error@+1 {{expected variable name}}
|
||||
#pragma omp parallel for simd linear(B::bfoo())
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
#pragma omp parallel for simd linear(B::ib,B:C1+C2)
|
||||
for (int i = 0; i < 10; ++i) ;
|
||||
}
|
||||
|
||||
template<int L, class T, class N> T test_template(T* arr, N num) {
|
||||
N i;
|
||||
T sum = (T)0;
|
||||
T ind2 = - num * L; // expected-note {{'ind2' defined here}}
|
||||
// expected-error@+1 {{argument of a linear clause should be of integral or pointer type}}
|
||||
#pragma omp parallel for simd linear(ind2:L)
|
||||
for (i = 0; i < num; ++i) {
|
||||
T cur = arr[(int)ind2];
|
||||
ind2 += L;
|
||||
sum += cur;
|
||||
}
|
||||
return T();
|
||||
}
|
||||
|
||||
template<int LEN> int test_warn() {
|
||||
int ind2 = 0;
|
||||
// expected-warning@+1 {{zero linear step (ind2 should probably be const)}}
|
||||
#pragma omp parallel for simd linear(ind2:LEN)
|
||||
for (int i = 0; i < 100; i++) {
|
||||
ind2 += LEN;
|
||||
}
|
||||
return ind2;
|
||||
}
|
||||
|
||||
struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
|
||||
extern S1 a;
|
||||
class S2 {
|
||||
mutable int a;
|
||||
public:
|
||||
S2():a(0) { }
|
||||
};
|
||||
const S2 b; // expected-note 2 {{'b' defined here}}
|
||||
const S2 ba[5];
|
||||
class S3 {
|
||||
int a;
|
||||
public:
|
||||
S3():a(0) { }
|
||||
};
|
||||
const S3 ca[5];
|
||||
class S4 {
|
||||
int a;
|
||||
S4();
|
||||
public:
|
||||
S4(int v):a(v) { }
|
||||
};
|
||||
class S5 {
|
||||
int a;
|
||||
S5():a(0) {}
|
||||
public:
|
||||
S5(int v):a(v) { }
|
||||
};
|
||||
|
||||
S3 h;
|
||||
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
|
||||
|
||||
template<class I, class C> int foomain(I argc, C **argv) {
|
||||
I e(4);
|
||||
I g(5);
|
||||
int i;
|
||||
int &j = i; // expected-note {{'j' defined here}}
|
||||
#pragma omp parallel for simd linear // expected-error {{expected '(' after 'linear'}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear () // expected-error {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argc : 5)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+2 {{linear variable with incomplete type 'S1'}}
|
||||
// expected-error@+1 {{const-qualified variable cannot be linear}}
|
||||
#pragma omp parallel for simd linear (a, b:B::ib)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argv[1]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear(e, g)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear(i)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel
|
||||
{
|
||||
int v = 0;
|
||||
int i;
|
||||
#pragma omp parallel for simd linear(v:i)
|
||||
for (int k = 0; k < argc; ++k) { i = k; v += i; }
|
||||
}
|
||||
#pragma omp parallel for simd linear(j) // expected-error {{arguments of OpenMP clause 'linear' cannot be of reference type}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
int v = 0;
|
||||
#pragma omp parallel for simd linear(v:j)
|
||||
for (int k = 0; k < argc; ++k) { ++k; v += j; }
|
||||
#pragma omp parallel for simd linear(i)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
double darr[100];
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'test_template<-4, double, int>' requested here}}
|
||||
test_template<-4>(darr, 4);
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'test_warn<0>' requested here}}
|
||||
test_warn<0>();
|
||||
|
||||
S4 e(4); // expected-note {{'e' defined here}}
|
||||
S5 g(5); // expected-note {{'g' defined here}}
|
||||
int i;
|
||||
int &j = i; // expected-note {{'j' defined here}}
|
||||
#pragma omp parallel for simd linear // expected-error {{expected '(' after 'linear'}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear () // expected-error {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argc)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+2 {{linear variable with incomplete type 'S1'}}
|
||||
// expected-error@+1 {{const-qualified variable cannot be linear}}
|
||||
#pragma omp parallel for simd linear (a, b)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear (argv[1]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
// expected-error@+2 {{argument of a linear clause should be of integral or pointer type, not 'S4'}}
|
||||
// expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}}
|
||||
#pragma omp parallel for simd linear(e, g)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel
|
||||
{
|
||||
int i;
|
||||
#pragma omp parallel for simd linear(i)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear(i : 4)
|
||||
for (int k = 0; k < argc; ++k) { ++k; i += 4; }
|
||||
}
|
||||
#pragma omp parallel for simd linear(j) // expected-error {{arguments of OpenMP clause 'linear' cannot be of reference type 'int &'}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel for simd linear(i)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
|
||||
foomain<int,char>(argc,argv);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,609 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s
|
||||
|
||||
class S {
|
||||
int a;
|
||||
S() : a(0) {}
|
||||
|
||||
public:
|
||||
S(int v) : a(v) {}
|
||||
S(const S &s) : a(s.a) {}
|
||||
};
|
||||
|
||||
static int sii;
|
||||
#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
|
||||
|
||||
int test_iteration_spaces() {
|
||||
const int N = 100;
|
||||
float a[N], b[N], c[N];
|
||||
int ii, jj, kk;
|
||||
float fii;
|
||||
double dii;
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; i += 1) {
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (char i = 0; i < 10; i++) {
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (char i = 0; i < 10; i += '\1') {
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (long long i = 0; i < 10; i++) {
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
// expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'double'}}
|
||||
#pragma omp parallel for simd
|
||||
for (long long i = 0; i < 10; i += 1.5) {
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (long long i = 0; i < 'z'; i += 1u) {
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
// expected-error@+2 {{variable must be of integer or random access iterator type}}
|
||||
#pragma omp parallel for simd
|
||||
for (float fi = 0; fi < 10.0; fi++) {
|
||||
c[(int)fi] = a[(int)fi] + b[(int)fi];
|
||||
}
|
||||
// expected-error@+2 {{variable must be of integer or random access iterator type}}
|
||||
#pragma omp parallel for simd
|
||||
for (double fi = 0; fi < 10.0; fi++) {
|
||||
c[(int)fi] = a[(int)fi] + b[(int)fi];
|
||||
}
|
||||
// expected-error@+2 {{variable must be of integer or random access iterator type}}
|
||||
#pragma omp parallel for simd
|
||||
for (int &ref = ii; ref < 10; ref++) {
|
||||
}
|
||||
// expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
|
||||
#pragma omp parallel for simd
|
||||
for (int i; i < 10; i++)
|
||||
c[i] = a[i];
|
||||
|
||||
// expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0, j = 0; i < 10; ++i)
|
||||
c[i] = a[i];
|
||||
|
||||
// expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
|
||||
#pragma omp parallel for simd
|
||||
for (; ii < 10; ++ii)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-warning@+3 {{expression result unused}}
|
||||
// expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii + 1; ii < 10; ++ii)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
|
||||
#pragma omp parallel for simd
|
||||
for (c[ii] = 0; ii < 10; ++ii)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// Ok to skip parenthesises.
|
||||
#pragma omp parallel for simd
|
||||
for (((ii)) = 0; ii < 10; ++ii)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i; i++)
|
||||
c[i] = a[i];
|
||||
|
||||
// expected-error@+3 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'i'}}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; jj < kk; ii++)
|
||||
c[i] = a[i];
|
||||
|
||||
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; !!i; i++)
|
||||
c[i] = a[i];
|
||||
|
||||
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i != 1; i++)
|
||||
c[i] = a[i];
|
||||
|
||||
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0;; i++)
|
||||
c[i] = a[i];
|
||||
|
||||
// Ok.
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 11; i > 10; i--)
|
||||
c[i] = a[i];
|
||||
|
||||
// Ok.
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
c[i] = a[i];
|
||||
|
||||
// Ok.
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ++ii)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ++jj)
|
||||
c[ii] = a[jj];
|
||||
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ++++ii)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// Ok but undefined behavior (in general, cannot check that incr
|
||||
// is really loop-invariant).
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ii = ii + ii)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'float'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ii = ii + 1.0f)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// Ok - step was converted to integer type.
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ii = ii + (int)1.1f)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; jj = ii + 2)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-warning@+3 {{relational comparison result unused}}
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii<10; jj> kk + 2)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10;)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-warning@+3 {{expression result unused}}
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; !ii)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ii ? ++ii : ++jj)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'ii'}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ii = ii < 10)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ii = ii + 0)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; ii = ii + (int)(0.8 - 0.45))
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; (ii) < 10; ii -= 25)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; (ii < 10); ii -= 0)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be negative due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii > 10; (ii += 0))
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; ii < 10; (ii) = (1 - 1) + (ii))
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be negative due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'ii' to decrease on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for ((ii = 0); ii > 10; (ii -= 0))
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'ii' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (ii = 0; (ii < 10); (ii -= 0))
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+2 {{defined as firstprivate}}
|
||||
// expected-error@+2 {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be firstprivate, predetermined as linear}}
|
||||
#pragma omp parallel for simd firstprivate(ii)
|
||||
for (ii = 0; ii < 10; ii++)
|
||||
c[ii] = a[ii];
|
||||
|
||||
#pragma omp parallel for simd linear(ii)
|
||||
for (ii = 0; ii < 10; ii++)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+2 {{defined as private}}
|
||||
// expected-error@+2 {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be private, predetermined as linear}}
|
||||
#pragma omp parallel for simd private(ii)
|
||||
for (ii = 0; ii < 10; ii++)
|
||||
c[ii] = a[ii];
|
||||
|
||||
// expected-note@+2 {{defined as lastprivate}}
|
||||
// expected-error@+2 {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be lastprivate, predetermined as linear}}
|
||||
#pragma omp parallel for simd lastprivate(ii)
|
||||
for (ii = 0; ii < 10; ii++)
|
||||
c[ii] = a[ii];
|
||||
|
||||
{
|
||||
// expected-error@+2 {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be threadprivate or thread local, predetermined as linear}}
|
||||
#pragma omp parallel for simd
|
||||
for (sii = 0; sii < 10; sii += 1)
|
||||
c[sii] = a[sii];
|
||||
}
|
||||
|
||||
// expected-error@+2 {{statement after '#pragma omp parallel for simd' must be a for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (auto &item : a) {
|
||||
item = item + 1;
|
||||
}
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'i' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (unsigned i = 9; i < 10; i--) {
|
||||
c[i] = a[i] + b[i];
|
||||
}
|
||||
|
||||
int(*lb)[4] = nullptr;
|
||||
#pragma omp parallel for simd
|
||||
for (int(*p)[4] = lb; p < lb + 8; ++p) {
|
||||
}
|
||||
|
||||
// expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
|
||||
#pragma omp parallel for simd
|
||||
for (int a{0}; a < 10; ++a) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Iterators allowed in openmp for-loops.
|
||||
namespace std {
|
||||
struct random_access_iterator_tag {};
|
||||
template <class Iter>
|
||||
struct iterator_traits {
|
||||
typedef typename Iter::difference_type difference_type;
|
||||
typedef typename Iter::iterator_category iterator_category;
|
||||
};
|
||||
template <class Iter>
|
||||
typename iterator_traits<Iter>::difference_type
|
||||
distance(Iter first, Iter last) { return first - last; }
|
||||
}
|
||||
class Iter0 {
|
||||
public:
|
||||
Iter0() {}
|
||||
Iter0(const Iter0 &) {}
|
||||
Iter0 operator++() { return *this; }
|
||||
Iter0 operator--() { return *this; }
|
||||
bool operator<(Iter0 a) { return true; }
|
||||
};
|
||||
int operator-(Iter0 a, Iter0 b) { return 0; }
|
||||
class Iter1 {
|
||||
public:
|
||||
Iter1(float f = 0.0f, double d = 0.0) {}
|
||||
Iter1(const Iter1 &) {}
|
||||
Iter1 operator++() { return *this; }
|
||||
Iter1 operator--() { return *this; }
|
||||
bool operator<(Iter1 a) { return true; }
|
||||
bool operator>=(Iter1 a) { return false; }
|
||||
};
|
||||
class GoodIter {
|
||||
public:
|
||||
GoodIter() {}
|
||||
GoodIter(const GoodIter &) {}
|
||||
GoodIter(int fst, int snd) {}
|
||||
GoodIter &operator=(const GoodIter &that) { return *this; }
|
||||
GoodIter &operator=(const Iter0 &that) { return *this; }
|
||||
GoodIter &operator+=(int x) { return *this; }
|
||||
explicit GoodIter(void *) {}
|
||||
GoodIter operator++() { return *this; }
|
||||
GoodIter operator--() { return *this; }
|
||||
bool operator!() { return true; }
|
||||
bool operator<(GoodIter a) { return true; }
|
||||
bool operator<=(GoodIter a) { return true; }
|
||||
bool operator>=(GoodIter a) { return false; }
|
||||
typedef int difference_type;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
int operator-(GoodIter a, GoodIter b) { return 0; }
|
||||
GoodIter operator-(GoodIter a) { return a; }
|
||||
GoodIter operator-(GoodIter a, int v) { return GoodIter(); }
|
||||
GoodIter operator+(GoodIter a, int v) { return GoodIter(); }
|
||||
GoodIter operator-(int v, GoodIter a) { return GoodIter(); }
|
||||
GoodIter operator+(int v, GoodIter a) { return GoodIter(); }
|
||||
|
||||
int test_with_random_access_iterator() {
|
||||
GoodIter begin, end;
|
||||
Iter0 begin0, end0;
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; I < end; ++I)
|
||||
++I;
|
||||
// expected-error@+2 {{variable must be of integer or random access iterator type}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter &I = begin; I < end; ++I)
|
||||
++I;
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; I >= end; --I)
|
||||
++I;
|
||||
// expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I(begin); I < end; ++I)
|
||||
++I;
|
||||
// expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I(nullptr); I < end; ++I)
|
||||
++I;
|
||||
// expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I(0); I < end; ++I)
|
||||
++I;
|
||||
// expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I(1, 2); I < end; ++I)
|
||||
++I;
|
||||
#pragma omp parallel for simd
|
||||
for (begin = GoodIter(0); begin < end; ++begin)
|
||||
++begin;
|
||||
#pragma omp parallel for simd
|
||||
for (begin = begin0; begin < end; ++begin)
|
||||
++begin;
|
||||
// expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}}
|
||||
#pragma omp parallel for simd
|
||||
for (++begin; begin < end; ++begin)
|
||||
++begin;
|
||||
#pragma omp parallel for simd
|
||||
for (begin = end; begin < end; ++begin)
|
||||
++begin;
|
||||
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; I - I; ++I)
|
||||
++I;
|
||||
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; begin < end; ++I)
|
||||
++I;
|
||||
// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'I'}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; !I; ++I)
|
||||
++I;
|
||||
// expected-note@+3 {{loop step is expected to be negative due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; I >= end; I = I + 1)
|
||||
++I;
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; I >= end; I = I - 1)
|
||||
++I;
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; I >= end; I = -I)
|
||||
++I;
|
||||
// expected-note@+3 {{loop step is expected to be negative due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; I >= end; I = 2 + I)
|
||||
++I;
|
||||
// expected-error@+2 {{increment clause of OpenMP for loop must perform simple addition or subtraction on loop variable 'I'}}
|
||||
#pragma omp parallel for simd
|
||||
for (GoodIter I = begin; I >= end; I = 2 - I)
|
||||
++I;
|
||||
#pragma omp parallel for simd
|
||||
for (Iter0 I = begin0; I < end0; ++I)
|
||||
++I;
|
||||
// Initializer is constructor without params.
|
||||
// expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
|
||||
#pragma omp parallel for simd
|
||||
for (Iter0 I; I < end0; ++I)
|
||||
++I;
|
||||
Iter1 begin1, end1;
|
||||
#pragma omp parallel for simd
|
||||
for (Iter1 I = begin1; I < end1; ++I)
|
||||
++I;
|
||||
// expected-note@+3 {{loop step is expected to be negative due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (Iter1 I = begin1; I >= end1; ++I)
|
||||
++I;
|
||||
// Initializer is constructor with all default params.
|
||||
// expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}}
|
||||
#pragma omp parallel for simd
|
||||
for (Iter1 I; I < end1; ++I) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename IT, int ST>
|
||||
class TC {
|
||||
public:
|
||||
int dotest_lt(IT begin, IT end) {
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (IT I = begin; I < end; I = I + ST) {
|
||||
++I;
|
||||
}
|
||||
// expected-note@+3 {{loop step is expected to be positive due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (IT I = begin; I <= end; I += ST) {
|
||||
++I;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (IT I = begin; I < end; ++I) {
|
||||
++I;
|
||||
}
|
||||
}
|
||||
|
||||
static IT step() {
|
||||
return IT(ST);
|
||||
}
|
||||
};
|
||||
template <typename IT, int ST = 0>
|
||||
int dotest_gt(IT begin, IT end) {
|
||||
// expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
|
||||
// expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (IT I = begin; I >= end; I = I + ST) {
|
||||
++I;
|
||||
}
|
||||
// expected-note@+3 2 {{loop step is expected to be negative due to this condition}}
|
||||
// expected-error@+2 2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (IT I = begin; I >= end; I += ST) {
|
||||
++I;
|
||||
}
|
||||
|
||||
// expected-note@+3 {{loop step is expected to be negative due to this condition}}
|
||||
// expected-error@+2 {{increment expression must cause 'I' to decrease on each iteration of OpenMP for loop}}
|
||||
#pragma omp parallel for simd
|
||||
for (IT I = begin; I >= end; ++I) {
|
||||
++I;
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (IT I = begin; I < end; I += TC<int, ST>::step()) {
|
||||
++I;
|
||||
}
|
||||
}
|
||||
|
||||
void test_with_template() {
|
||||
GoodIter begin, end;
|
||||
TC<GoodIter, 100> t1;
|
||||
TC<GoodIter, -100> t2;
|
||||
t1.dotest_lt(begin, end);
|
||||
t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}}
|
||||
dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}}
|
||||
dotest_gt<unsigned, -10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, -10>' requested here}}
|
||||
}
|
||||
|
||||
void test_loop_break() {
|
||||
const int N = 100;
|
||||
float a[N], b[N], c[N];
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; i++) {
|
||||
c[i] = a[i] + b[i];
|
||||
for (int j = 0; j < 10; ++j) {
|
||||
if (a[i] > b[j])
|
||||
break; // OK in nested loop
|
||||
}
|
||||
switch (i) {
|
||||
case 1:
|
||||
b[i]++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (c[i] > 10)
|
||||
break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
|
||||
|
||||
if (c[i] > 11)
|
||||
break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int j = 0; j < 10; j++) {
|
||||
c[i] = a[i] + b[i];
|
||||
if (c[i] > 10) {
|
||||
if (c[i] < 20) {
|
||||
break; // OK
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void test_loop_eh() {
|
||||
const int N = 100;
|
||||
float a[N], b[N], c[N];
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; i++) {
|
||||
c[i] = a[i] + b[i];
|
||||
try { // expected-error {{'try' statement cannot be used in OpenMP simd region}}
|
||||
for (int j = 0; j < 10; ++j) {
|
||||
if (a[i] > b[j])
|
||||
throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
|
||||
}
|
||||
throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
|
||||
} catch (float f) {
|
||||
if (f > 0.1)
|
||||
throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
|
||||
return; // expected-error {{cannot return from OpenMP region}}
|
||||
}
|
||||
switch (i) {
|
||||
case 1:
|
||||
b[i]++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
for (int j = 0; j < 10; j++) {
|
||||
if (c[i] > 10)
|
||||
throw c[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}}
|
||||
}
|
||||
}
|
||||
if (c[9] > 10)
|
||||
throw c[9]; // OK
|
||||
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
struct S {
|
||||
void g() { throw 0; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void test_loop_firstprivate_lastprivate() {
|
||||
S s(4);
|
||||
#pragma omp parallel for simd lastprivate(s) firstprivate(s)
|
||||
for (int i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
void test_ordered() {
|
||||
// expected-error@+1 2 {{unexpected OpenMP clause 'ordered' in directive '#pragma omp parallel for simd'}}
|
||||
#pragma omp parallel for simd ordered ordered // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'ordered' clause}}
|
||||
for (int i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
void test_nowait() {
|
||||
// expected-error@+1 2 {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for simd'}}
|
||||
#pragma omp parallel for simd nowait nowait // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'nowait' clause}}
|
||||
for (int i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -std=c++11 -o - %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
#pragma omp parallel for simd // expected-error {{unexpected OpenMP directive '#pragma omp parallel for simd'}}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp parallel for simd { // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd ( // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd[ // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd] // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd } // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
#pragma omp parallel for simd unknown()
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
L1:
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
goto L1; // expected-error {{use of undeclared label 'L1'}}
|
||||
argc++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
switch (argc) {
|
||||
case (0):
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
foo();
|
||||
break; // expected-error {{'break' statement cannot be used in OpenMP for loop}}
|
||||
continue;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel for simd default(none)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
|
||||
|
||||
goto L2; // expected-error {{use of undeclared label 'L2'}}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < argc; ++i)
|
||||
L2:
|
||||
foo();
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
return 1; // expected-error {{cannot return from OpenMP region}}
|
||||
}
|
||||
|
||||
[[]] // expected-error {{an attribute list cannot appear here}}
|
||||
#pragma omp parallel for simd
|
||||
for (int n = 0; n < 100; ++n) {
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void test_ordered() {
|
||||
// expected-error@+1 2 {{unexpected OpenMP clause 'ordered' in directive '#pragma omp parallel for simd'}}
|
||||
#pragma omp parallel for simd ordered ordered // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'ordered' clause}}
|
||||
for (int i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
|
@ -0,0 +1,657 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -verify %s
|
||||
|
||||
// expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel for simd'}}
|
||||
#pragma omp parallel for simd
|
||||
|
||||
// expected-error@+1 {{unexpected OpenMP directive '#pragma omp parallel for simd'}}
|
||||
#pragma omp parallel for simd foo
|
||||
|
||||
void test_no_clause() {
|
||||
int i;
|
||||
#pragma omp parallel for simd
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-error@+2 {{statement after '#pragma omp parallel for simd' must be a for loop}}
|
||||
#pragma omp parallel for simd
|
||||
++i;
|
||||
}
|
||||
|
||||
void test_branch_protected_scope() {
|
||||
int i = 0;
|
||||
L1:
|
||||
++i;
|
||||
|
||||
int x[24];
|
||||
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd
|
||||
for (i = 0; i < 16; ++i) {
|
||||
if (i == 5)
|
||||
goto L1; // expected-error {{use of undeclared label 'L1'}}
|
||||
else if (i == 6)
|
||||
return; // expected-error {{cannot return from OpenMP region}}
|
||||
else if (i == 7)
|
||||
goto L2;
|
||||
else if (i == 8) {
|
||||
L2:
|
||||
x[i]++;
|
||||
}
|
||||
}
|
||||
|
||||
if (x[0] == 0)
|
||||
goto L2; // expected-error {{use of undeclared label 'L2'}}
|
||||
else if (x[1] == 1)
|
||||
goto L1;
|
||||
}
|
||||
|
||||
void test_invalid_clause() {
|
||||
int i;
|
||||
#pragma omp parallel
|
||||
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
#pragma omp parallel for simd foo bar
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
void test_non_identifiers() {
|
||||
int i, x;
|
||||
|
||||
#pragma omp parallel
|
||||
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
#pragma omp parallel for simd;
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
#pragma omp parallel for simd linear(x);
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
#pragma omp parallel
|
||||
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
#pragma omp parallel for simd private(x);
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
#pragma omp parallel
|
||||
// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
#pragma omp parallel for simd, private(x);
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
extern int foo();
|
||||
void test_safelen() {
|
||||
int i;
|
||||
// expected-error@+1 {{expected '('}}
|
||||
#pragma omp parallel for simd safelen
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd safelen()
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(,
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
// expected-error@+1 {{expected '('}}
|
||||
#pragma omp parallel for simd safelen 4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(4
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(4,
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(4, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel for simd safelen(4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(4 4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(4, , 4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel for simd safelen(4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd safelen(4, 8)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expression is not an integer constant expression}}
|
||||
#pragma omp parallel for simd safelen(2.5)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expression is not an integer constant expression}}
|
||||
#pragma omp parallel for simd safelen(foo())
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd safelen(-5)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd safelen(0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd safelen(5 - 5)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
void test_collapse() {
|
||||
int i;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected '('}}
|
||||
#pragma omp parallel for simd collapse
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd collapse(
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd collapse()
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd collapse(,
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd collapse(, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-warning@+2 {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
// expected-error@+1 {{expected '('}}
|
||||
#pragma omp parallel for simd collapse 4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
|
||||
#pragma omp parallel for simd collapse(4
|
||||
for (i = 0; i < 16; ++i)
|
||||
; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
|
||||
#pragma omp parallel for simd collapse(4,
|
||||
for (i = 0; i < 16; ++i)
|
||||
; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
|
||||
#pragma omp parallel for simd collapse(4, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel
|
||||
// expected-note@+1 {{as specified in 'collapse' clause}}
|
||||
#pragma omp parallel for simd collapse(4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
|
||||
#pragma omp parallel for simd collapse(4 4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
|
||||
#pragma omp parallel for simd collapse(4, , 4)
|
||||
for (i = 0; i < 16; ++i)
|
||||
; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd collapse(4)
|
||||
for (int i1 = 0; i1 < 16; ++i1)
|
||||
for (int i2 = 0; i2 < 16; ++i2)
|
||||
for (int i3 = 0; i3 < 16; ++i3)
|
||||
for (int i4 = 0; i4 < 16; ++i4)
|
||||
foo();
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}}
|
||||
// expected-note@+1 {{to match this '('}} expected-note@+1 {{as specified in 'collapse' clause}}
|
||||
#pragma omp parallel for simd collapse(4, 8)
|
||||
for (i = 0; i < 16; ++i)
|
||||
; // expected-error {{expected 4 for loops after '#pragma omp parallel for simd', but found only 1}}
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expression is not an integer constant expression}}
|
||||
#pragma omp parallel for simd collapse(2.5)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expression is not an integer constant expression}}
|
||||
#pragma omp parallel for simd collapse(foo())
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd collapse(-5)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd collapse(0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{argument to 'collapse' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd collapse(5 - 5)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd collapse(2)
|
||||
for (i = 0; i < 16; ++i)
|
||||
for (int j = 0; j < 16; ++j)
|
||||
// expected-error@+1 {{OpenMP constructs may not be nested inside a simd region}}
|
||||
#pragma omp parallel for simd reduction(+ : i, j)
|
||||
for (int k = 0; k < 16; ++k)
|
||||
i += j;
|
||||
}
|
||||
|
||||
void test_linear() {
|
||||
int i;
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd linear(
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected expression}}
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd linear(,
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected expression}}
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd linear(, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd linear()
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd linear(int)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected variable name}}
|
||||
#pragma omp parallel for simd linear(0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{use of undeclared identifier 'x'}}
|
||||
#pragma omp parallel for simd linear(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{use of undeclared identifier 'x'}}
|
||||
// expected-error@+1 {{use of undeclared identifier 'y'}}
|
||||
#pragma omp parallel for simd linear(x, y)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+3 {{use of undeclared identifier 'x'}}
|
||||
// expected-error@+2 {{use of undeclared identifier 'y'}}
|
||||
// expected-error@+1 {{use of undeclared identifier 'z'}}
|
||||
#pragma omp parallel for simd linear(x, y, z)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
int x, y;
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd linear(x :)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd linear(x :, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel for simd linear(x : 1)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel for simd linear(x : 2 * 2)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd linear(x : 1, y)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd linear(x : 1, y, z : 1)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-note@+2 {{defined as linear}}
|
||||
// expected-error@+1 {{linear variable cannot be linear}}
|
||||
#pragma omp parallel for simd linear(x) linear(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-note@+2 {{defined as private}}
|
||||
// expected-error@+1 {{private variable cannot be linear}}
|
||||
#pragma omp parallel for simd private(x) linear(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-note@+2 {{defined as linear}}
|
||||
// expected-error@+1 {{linear variable cannot be private}}
|
||||
#pragma omp parallel for simd linear(x) private(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-warning@+1 {{zero linear step (x and other variables in clause should probably be const)}}
|
||||
#pragma omp parallel for simd linear(x, y : 0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-note@+2 {{defined as linear}}
|
||||
// expected-error@+1 {{linear variable cannot be lastprivate}}
|
||||
#pragma omp parallel for simd linear(x) lastprivate(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
#pragma omp parallel
|
||||
// expected-note@+2 {{defined as lastprivate}}
|
||||
// expected-error@+1 {{lastprivate variable cannot be linear}}
|
||||
#pragma omp parallel for simd lastprivate(x) linear(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
void test_aligned() {
|
||||
int i;
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd aligned(
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected expression}}
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd aligned(,
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{expected expression}}
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd aligned(, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd aligned()
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd aligned(int)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected variable name}}
|
||||
#pragma omp parallel for simd aligned(0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{use of undeclared identifier 'x'}}
|
||||
#pragma omp parallel for simd aligned(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+2 {{use of undeclared identifier 'x'}}
|
||||
// expected-error@+1 {{use of undeclared identifier 'y'}}
|
||||
#pragma omp parallel for simd aligned(x, y)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+3 {{use of undeclared identifier 'x'}}
|
||||
// expected-error@+2 {{use of undeclared identifier 'y'}}
|
||||
// expected-error@+1 {{use of undeclared identifier 'z'}}
|
||||
#pragma omp parallel for simd aligned(x, y, z)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
int *x, y, z[25]; // expected-note 4 {{'y' defined here}}
|
||||
#pragma omp parallel for simd aligned(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel for simd aligned(z)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd aligned(x :)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd aligned(x :, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel for simd aligned(x : 1)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel for simd aligned(x : 2 * 2)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd aligned(x : 1, y)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd aligned(x : 1, y, z : 1)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
|
||||
#pragma omp parallel for simd aligned(x, y)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
// expected-error@+1 {{argument of aligned clause should be array or pointer, not 'int'}}
|
||||
#pragma omp parallel for simd aligned(x, y, z)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-note@+2 {{defined as aligned}}
|
||||
// expected-error@+1 {{a variable cannot appear in more than one aligned clause}}
|
||||
#pragma omp parallel for simd aligned(x) aligned(z, x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
// expected-note@+3 {{defined as aligned}}
|
||||
// expected-error@+2 {{a variable cannot appear in more than one aligned clause}}
|
||||
// expected-error@+1 2 {{argument of aligned clause should be array or pointer, not 'int'}}
|
||||
#pragma omp parallel for simd aligned(x, y, z) aligned(y, z)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
void test_private() {
|
||||
int i;
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected expression}}
|
||||
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd private(
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
|
||||
// expected-error@+1 2 {{expected expression}}
|
||||
#pragma omp parallel for simd private(,
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 2 {{expected expression}}
|
||||
#pragma omp parallel for simd private(, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd private()
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd private(int)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected variable name}}
|
||||
#pragma omp parallel for simd private(0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
int x, y, z;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd private(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd private(x, y)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd private(x, y, z)
|
||||
for (i = 0; i < 16; ++i) {
|
||||
x = y * i + z;
|
||||
}
|
||||
}
|
||||
|
||||
void test_lastprivate() {
|
||||
int i;
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd lastprivate(
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
|
||||
// expected-error@+1 2 {{expected expression}}
|
||||
#pragma omp parallel for simd lastprivate(,
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 2 {{expected expression}}
|
||||
#pragma omp parallel for simd lastprivate(, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd lastprivate()
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd lastprivate(int)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected variable name}}
|
||||
#pragma omp parallel for simd lastprivate(0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
int x, y, z;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd lastprivate(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd lastprivate(x, y)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd lastprivate(x, y, z)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
void test_firstprivate() {
|
||||
int i;
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd firstprivate(
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
|
||||
// expected-error@+1 2 {{expected expression}}
|
||||
#pragma omp parallel for simd firstprivate(,
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 2 {{expected expression}}
|
||||
#pragma omp parallel for simd firstprivate(, )
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd firstprivate()
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected expression}}
|
||||
#pragma omp parallel for simd firstprivate(int)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
// expected-error@+1 {{expected variable name}}
|
||||
#pragma omp parallel for simd firstprivate(0)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
|
||||
int x, y, z;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd lastprivate(x) firstprivate(x)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd lastprivate(x, y) firstprivate(x, y)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
#pragma omp parallel
|
||||
#pragma omp parallel for simd lastprivate(x, y, z) firstprivate(x, y, z)
|
||||
for (i = 0; i < 16; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
void test_loop_messages() {
|
||||
float a[100], b[100], c[100];
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{variable must be of integer or pointer type}}
|
||||
#pragma omp parallel for simd
|
||||
for (float fi = 0; fi < 10.0; fi++) {
|
||||
c[(int)fi] = a[(int)fi] + b[(int)fi];
|
||||
}
|
||||
#pragma omp parallel
|
||||
// expected-error@+2 {{variable must be of integer or pointer type}}
|
||||
#pragma omp parallel for simd
|
||||
for (double fi = 0; fi < 10.0; fi++) {
|
||||
c[(int)fi] = a[(int)fi] + b[(int)fi];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}}
|
||||
|
||||
template <class T, typename S, int N> // expected-note {{declared here}}
|
||||
T tmain(T argc, S **argv) {
|
||||
T i;
|
||||
#pragma omp parallel for simd num_threads // expected-error {{expected '(' after 'num_threads'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads () // expected-error {{expected expression}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads ((argc > 0) ? argv[1] : argv[2]) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (S) // expected-error {{'S' does not refer to a value}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (argc)
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (N) // expected-error {{argument to 'num_threads' clause must be a positive integer value}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
|
||||
return argc;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp parallel for simd num_threads // expected-error {{expected '(' after 'num_threads'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads () // expected-error {{expected expression}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (argc > 0 ? argv[1] : argv[2]) // expected-error {{integral }}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp parallel for simd num_threads (num_threads(tmain<int, char, -1>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} expected-note {{in instantiation of function template specialization 'tmain<int, char, -1>' requested here}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
|
||||
return tmain<int, char, 3>(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 3>' requested here}}
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
|
||||
extern S1 a;
|
||||
class S2 {
|
||||
mutable int a;
|
||||
|
||||
public:
|
||||
S2() : a(0) {}
|
||||
};
|
||||
const S2 b;
|
||||
const S2 ba[5];
|
||||
class S3 {
|
||||
int a;
|
||||
|
||||
public:
|
||||
S3() : a(0) {}
|
||||
};
|
||||
const S3 ca[5];
|
||||
class S4 { // expected-note {{'S4' declared here}}
|
||||
int a;
|
||||
S4();
|
||||
|
||||
public:
|
||||
S4(int v) : a(v) {}
|
||||
};
|
||||
class S5 { // expected-note {{'S5' declared here}}
|
||||
int a;
|
||||
S5() : a(0) {}
|
||||
|
||||
public:
|
||||
S5(int v) : a(v) {}
|
||||
};
|
||||
|
||||
S3 h;
|
||||
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
|
||||
|
||||
template <class I, class C>
|
||||
int foomain(I argc, C **argv) {
|
||||
I e(4);
|
||||
I g(5);
|
||||
int i;
|
||||
int &j = i; // expected-note {{'j' defined here}}
|
||||
#pragma omp parallel for simd private // expected-error {{expected '(' after 'private'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private() // expected-error {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argc)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argv[1]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(e, g)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for simd'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel
|
||||
{
|
||||
int v = 0;
|
||||
int i;
|
||||
#pragma omp parallel for simd private(i)
|
||||
for (int k = 0; k < argc; ++k) {
|
||||
i = k;
|
||||
v += i;
|
||||
}
|
||||
}
|
||||
#pragma omp parallel shared(i)
|
||||
#pragma omp parallel private(i)
|
||||
#pragma omp parallel for simd private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(i)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
S4 e(4); // expected-note {{'e' defined here}}
|
||||
S5 g(5); // expected-note {{'g' defined here}}
|
||||
int i;
|
||||
int &j = i; // expected-note {{'j' defined here}}
|
||||
#pragma omp parallel for simd private // expected-error {{expected '(' after 'private'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private() // expected-error {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argc)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(a, b) // expected-error {{private variable with incomplete type 'S1'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(argv[1]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(e, g) // expected-error 2 {{private variable must have an accessible, unambiguous default constructor}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd nowait // expected-error {{unexpected OpenMP clause 'nowait' in directive '#pragma omp parallel for simd'}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel
|
||||
{
|
||||
int i;
|
||||
#pragma omp parallel for simd private(i)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
}
|
||||
#pragma omp parallel shared(i)
|
||||
#pragma omp parallel private(i)
|
||||
#pragma omp parallel for simd private(j) // expected-error {{arguments of OpenMP clause 'private' cannot be of reference type}}
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
#pragma omp parallel for simd private(i)
|
||||
for (int k = 0; k < argc; ++k)
|
||||
++k;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -o - %s
|
||||
|
||||
void foo();
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int i;
|
||||
#pragma omp parallel for simd proc_bind // expected-error {{expected '(' after 'proc_bind'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd proc_bind( // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd proc_bind() // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd proc_bind(master // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd proc_bind(close), proc_bind(spread) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'proc_bind' clause}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd proc_bind(x) // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}}
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
#pragma omp parallel for simd proc_bind(master)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
|
||||
#pragma omp parallel proc_bind(close)
|
||||
#pragma omp parallel for simd proc_bind(spread)
|
||||
for (i = 0; i < argc; ++i)
|
||||
foo();
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,295 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -o - %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}} expected-note 4 {{forward declaration of 'S1'}}
|
||||
extern S1 a;
|
||||
class S2 {
|
||||
mutable int a;
|
||||
S2 &operator+=(const S2 &arg) { return (*this); }
|
||||
|
||||
public:
|
||||
S2() : a(0) {}
|
||||
S2(S2 &s2) : a(s2.a) {}
|
||||
static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
|
||||
static const float S2sc;
|
||||
};
|
||||
const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
|
||||
S2 b; // expected-note 2 {{'b' defined here}}
|
||||
const S2 ba[5]; // expected-note 2 {{'ba' defined here}}
|
||||
class S3 {
|
||||
int a;
|
||||
|
||||
public:
|
||||
S3() : a(0) {}
|
||||
S3(const S3 &s3) : a(s3.a) {}
|
||||
S3 operator+=(const S3 &arg1) { return arg1; }
|
||||
};
|
||||
int operator+=(const S3 &arg1, const S3 &arg2) { return 5; }
|
||||
S3 c; // expected-note 2 {{'c' defined here}}
|
||||
const S3 ca[5]; // expected-note 2 {{'ca' defined here}}
|
||||
extern const int f; // expected-note 4 {{'f' declared here}}
|
||||
class S4 { // expected-note {{'S4' declared here}}
|
||||
int a;
|
||||
S4();
|
||||
S4(const S4 &s4);
|
||||
S4 &operator+=(const S4 &arg) { return (*this); }
|
||||
|
||||
public:
|
||||
S4(int v) : a(v) {}
|
||||
};
|
||||
S4 &operator&=(S4 &arg1, S4 &arg2) { return arg1; }
|
||||
class S5 {
|
||||
int a;
|
||||
S5() : a(0) {}
|
||||
S5(const S5 &s5) : a(s5.a) {}
|
||||
S5 &operator+=(const S5 &arg);
|
||||
|
||||
public:
|
||||
S5(int v) : a(v) {}
|
||||
};
|
||||
class S6 {
|
||||
int a;
|
||||
|
||||
public:
|
||||
S6() : a(6) {}
|
||||
operator int() { return 6; }
|
||||
} o; // expected-note 2 {{'o' defined here}}
|
||||
|
||||
S3 h, k;
|
||||
#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}}
|
||||
|
||||
template <class T> // expected-note {{declared here}}
|
||||
T tmain(T argc) { // expected-note 2 {{'argc' defined here}}
|
||||
const T d = T(); // expected-note 4 {{'d' defined here}}
|
||||
const T da[5] = {T()}; // expected-note 2 {{'da' defined here}}
|
||||
T qa[5] = {T()};
|
||||
T i;
|
||||
T &j = i; // expected-note 4 {{'j' defined here}}
|
||||
S3 &p = k; // expected-note 2 {{'p' defined here}}
|
||||
const T &r = da[(int)i]; // expected-note 2 {{'r' defined here}}
|
||||
T &q = qa[(int)i]; // expected-note 2 {{'q' defined here}}
|
||||
T fl; // expected-note {{'fl' defined here}}
|
||||
#pragma omp parallel for simd reduction // expected-error {{expected '(' after 'reduction'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(& : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{variable of type 'float' is not valid for specified reduction operation}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{variable of type 'float' is not valid for specified reduction operation}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(|| : argc ? i : argc) // expected-error 2 {{expected variable name}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(&& : argc)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(^ : T) // expected-error {{'T' does not refer to a value}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 3 {{const-qualified variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(min : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 3 {{const-qualified variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(max : qa[1]) // expected-error 2 {{expected variable name}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : ba) // expected-error {{a reduction variable with array type 'const S2 [5]'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(* : ca) // expected-error {{a reduction variable with array type 'const S3 [5]'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(- : da) // expected-error {{a reduction variable with array type 'const int [5]'}} expected-error {{a reduction variable with array type 'const float [5]'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : o) // expected-error {{variable of type 'class S6' is not valid for specified reduction operation}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 4 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel private(k)
|
||||
#pragma omp parallel for simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : p), reduction(+ : p) // expected-error 3 {{variable can appear only once in OpenMP 'reduction' clause}} expected-note 3 {{previously referenced here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : r) // expected-error 2 {{const-qualified variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel shared(i)
|
||||
#pragma omp parallel reduction(min : i)
|
||||
#pragma omp parallel for simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel private(fl)
|
||||
#pragma omp parallel for simd reduction(+ : fl)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel reduction(* : fl)
|
||||
#pragma omp parallel for simd reduction(+ : fl)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
|
||||
return T();
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const int d = 5; // expected-note 2 {{'d' defined here}}
|
||||
const int da[5] = {0}; // expected-note {{'da' defined here}}
|
||||
int qa[5] = {0};
|
||||
S4 e(4); // expected-note {{'e' defined here}}
|
||||
S5 g(5); // expected-note {{'g' defined here}}
|
||||
int i;
|
||||
int &j = i; // expected-note 2 {{'j' defined here}}
|
||||
S3 &p = k; // expected-note 2 {{'p' defined here}}
|
||||
const int &r = da[i]; // expected-note {{'r' defined here}}
|
||||
int &q = qa[i]; // expected-note {{'q' defined here}}
|
||||
float fl; // expected-note {{'fl' defined here}}
|
||||
#pragma omp parallel for simd reduction // expected-error {{expected '(' after 'reduction'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction + // expected-error {{expected '(' after 'reduction'}} expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction( // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(- // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction() // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(*) // expected-warning {{missing ':' after reduction identifier - ignoring}} expected-error {{expected expression}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(\) // expected-error {{expected unqualified-id}} expected-warning {{missing ':' after reduction identifier - ignoring}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(foo : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(~ : argc) // expected-error {{expected unqualified-id}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(&& : argc)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(^ : S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{const-qualified variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(min : a, b, c, d, f) // expected-error {{reduction variable with incomplete type 'S1'}} expected-error 2 {{arguments of OpenMP clause 'reduction' for 'min' or 'max' must be of arithmetic type}} expected-error 2 {{const-qualified variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(max : argv[1]) // expected-error {{expected variable name}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : ba) // expected-error {{a reduction variable with array type 'const S2 [5]'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(* : ca) // expected-error {{a reduction variable with array type 'const S3 [5]'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(- : da) // expected-error {{a reduction variable with array type 'const int [5]'}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(^ : fl) // expected-error {{variable of type 'float' is not valid for specified reduction operation}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(&& : S2::S2sc) // expected-error {{const-qualified variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(& : e, g) // expected-error {{reduction variable must have an accessible, unambiguous default constructor}} expected-error {{variable of type 'S5' is not valid for specified reduction operation}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : h, k) // expected-error {{threadprivate or thread local variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : o) // expected-error {{variable of type 'class S6' is not valid for specified reduction operation}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd private(i), reduction(+ : j), reduction(+ : q) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel private(k)
|
||||
#pragma omp parallel for simd reduction(+ : p), reduction(+ : p) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : p), reduction(+ : p) // expected-error {{variable can appear only once in OpenMP 'reduction' clause}} expected-note {{previously referenced here}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel for simd reduction(+ : r) // expected-error {{const-qualified variable cannot be reduction}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel shared(i)
|
||||
#pragma omp parallel reduction(min : i)
|
||||
#pragma omp parallel for simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel private(fl)
|
||||
#pragma omp parallel for simd reduction(+ : fl)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
#pragma omp parallel reduction(* : fl)
|
||||
#pragma omp parallel for simd reduction(+ : fl)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
foo();
|
||||
|
||||
return tmain(argc) + tmain(fl); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<float>' requested here}}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}}
|
||||
|
||||
template <class T, typename S, int N, int ST> // expected-note {{declared here}}
|
||||
T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
|
||||
#pragma omp parallel for simd safelen // expected-error {{expected '(' after 'safelen'}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd safelen () // expected-error {{expected expression}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
|
||||
// expected-error@+2 2 {{expression is not an integral constant expression}}
|
||||
// expected-note@+1 2 {{read of non-const variable 'argc' is not allowed in a constant expression}}
|
||||
#pragma omp parallel for simd safelen (argc
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+1 {{argument to 'safelen' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd safelen (ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd safelen (1)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd safelen ((ST > 0) ? 1 + ST : 2)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+3 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}}
|
||||
// expected-error@+2 2 {{argument to 'safelen' clause must be a positive integer value}}
|
||||
// expected-error@+1 2 {{expression is not an integral constant expression}}
|
||||
#pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd safelen (S) // expected-error {{'S' does not refer to a value}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+1 2 {{expression is not an integral constant expression}}
|
||||
#pragma omp parallel for simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd safelen (4)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd safelen (N) // expected-error {{argument to 'safelen' clause must be a positive integer value}}
|
||||
for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
return argc;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp parallel for simd safelen // expected-error {{expected '(' after 'safelen'}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd safelen ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd safelen () // expected-error {{expected expression}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd safelen (4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd safelen (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd safelen (foobool(1) > 0 ? 1 : 2) // expected-error {{expression is not an integral constant expression}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+3 {{expression is not an integral constant expression}}
|
||||
// expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}}
|
||||
// expected-error@+1 2 {{argument to 'safelen' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5)
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd safelen (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+1 {{expression is not an integral constant expression}}
|
||||
#pragma omp parallel for simd safelen (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+3 {{statement after '#pragma omp parallel for simd' must be a for loop}}
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
|
||||
#pragma omp parallel for simd safelen(safelen(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
|
||||
foo();
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 12, 4>' requested here}}
|
||||
return tmain<int, char, 12, 4>(argc, argv);
|
||||
}
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp=libiomp5 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}}
|
||||
|
||||
template <class T, typename S, int N, int ST> // expected-note {{declared here}}
|
||||
T tmain(T argc, S **argv) {
|
||||
#pragma omp parallel for simd schedule // expected-error {{expected '(' after 'schedule'}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule ( // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule () // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (auto // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (auto_dynamic // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (auto, // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (runtime, 3) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}}
|
||||
#pragma omp parallel for simd schedule (guided argc
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+1 2 {{argument to 'schedule' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (dynamic, 1)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (guided, (ST > 0) ? 1 + ST : 2)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'schedule' clause}}
|
||||
// expected-error@+1 {{argument to 'schedule' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (static, S) // expected-error {{'S' does not refer to a value}} expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+1 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
|
||||
#pragma omp parallel for simd schedule (guided, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (dynamic, 1)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp parallel for simd schedule (static, N) // expected-error {{argument to 'schedule' clause must be a positive integer value}}
|
||||
for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
return argc;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp parallel for simd schedule // expected-error {{expected '(' after 'schedule'}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule ( // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule () // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule (auto // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule (auto_dynamic // expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule (auto, // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule (runtime, 3) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule (guided, 4 // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule (static, 2+2)) // expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule (dynamic, foobool(1) > 0 ? 1 : 2)
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'schedule' clause}}
|
||||
// expected-error@+1 {{argument to 'schedule' clause must be a positive integer value}}
|
||||
#pragma omp parallel for simd schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5)
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp parallel for simd schedule (guided, S1) // expected-error {{'S1' does not refer to a value}} expected-warning {{extra tokens at the end of '#pragma omp parallel for simd' are ignored}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'char *'}}
|
||||
#pragma omp parallel for simd schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+3 {{statement after '#pragma omp parallel for simd' must be a for loop}}
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
|
||||
#pragma omp parallel for simd schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
foo();
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
|
||||
return tmain<int, char, 1, 0>(argc, argv);
|
||||
}
|
||||
|
|
@ -1871,6 +1871,7 @@ public:
|
|||
void VisitOMPMasterDirective(const OMPMasterDirective *D);
|
||||
void VisitOMPCriticalDirective(const OMPCriticalDirective *D);
|
||||
void VisitOMPParallelForDirective(const OMPParallelForDirective *D);
|
||||
void VisitOMPParallelForSimdDirective(const OMPParallelForSimdDirective *D);
|
||||
void VisitOMPParallelSectionsDirective(const OMPParallelSectionsDirective *D);
|
||||
void VisitOMPTaskDirective(const OMPTaskDirective *D);
|
||||
void VisitOMPTaskyieldDirective(const OMPTaskyieldDirective *D);
|
||||
|
@ -2374,6 +2375,11 @@ EnqueueVisitor::VisitOMPParallelForDirective(const OMPParallelForDirective *D) {
|
|||
VisitOMPLoopDirective(D);
|
||||
}
|
||||
|
||||
void EnqueueVisitor::VisitOMPParallelForSimdDirective(
|
||||
const OMPParallelForSimdDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
}
|
||||
|
||||
void EnqueueVisitor::VisitOMPParallelSectionsDirective(
|
||||
const OMPParallelSectionsDirective *D) {
|
||||
VisitOMPExecutableDirective(D);
|
||||
|
@ -4161,6 +4167,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
|
|||
return cxstring::createRef("OMPCriticalDirective");
|
||||
case CXCursor_OMPParallelForDirective:
|
||||
return cxstring::createRef("OMPParallelForDirective");
|
||||
case CXCursor_OMPParallelForSimdDirective:
|
||||
return cxstring::createRef("OMPParallelForSimdDirective");
|
||||
case CXCursor_OMPParallelSectionsDirective:
|
||||
return cxstring::createRef("OMPParallelSectionsDirective");
|
||||
case CXCursor_OMPTaskDirective:
|
||||
|
|
|
@ -548,6 +548,9 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent,
|
|||
case Stmt::OMPParallelForDirectiveClass:
|
||||
K = CXCursor_OMPParallelForDirective;
|
||||
break;
|
||||
case Stmt::OMPParallelForSimdDirectiveClass:
|
||||
K = CXCursor_OMPParallelForSimdDirective;
|
||||
break;
|
||||
case Stmt::OMPParallelSectionsDirectiveClass:
|
||||
K = CXCursor_OMPParallelSectionsDirective;
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue