summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmtOpenMP.cpp
diff options
context:
space:
mode:
authorCarlo Bertolli <cbertol@us.ibm.com>2017-12-04 20:57:19 +0000
committerCarlo Bertolli <cbertol@us.ibm.com>2017-12-04 20:57:19 +0000
commit56a2aa4ddc6cd3dbb19fc548d7b282f41342a094 (patch)
tree77ca748b21791a181e6442b47dbc12338f0d9351 /clang/lib/CodeGen/CGStmtOpenMP.cpp
parente117129ef7a4bec25e8105bb498fcc9049402687 (diff)
downloadbcm5719-llvm-56a2aa4ddc6cd3dbb19fc548d7b282f41342a094.tar.gz
bcm5719-llvm-56a2aa4ddc6cd3dbb19fc548d7b282f41342a094.zip
[OpenMP] Initial implementation of code generation for pragma 'teams distribute parallel for simd' on host
https://reviews.llvm.org/D40795 This includes regression tests for all associated clauses. llvm-svn: 319696
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp34
1 files changed, 22 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 96f5a655956..72847fa2827 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -2100,18 +2100,6 @@ void CodeGenFunction::EmitOMPTeamsDistributeSimdDirective(
});
}
-void CodeGenFunction::EmitOMPTeamsDistributeParallelForSimdDirective(
- const OMPTeamsDistributeParallelForSimdDirective &S) {
- OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
- CGM.getOpenMPRuntime().emitInlinedDirective(
- *this, OMPD_teams_distribute_parallel_for_simd,
- [&S](CodeGenFunction &CGF, PrePostActionTy &) {
- OMPLoopScope PreInitScope(CGF, S);
- CGF.EmitStmt(
- cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
- });
-}
-
void CodeGenFunction::EmitOMPTargetTeamsDistributeDirective(
const OMPTargetTeamsDistributeDirective &S) {
OMPLexicalScope Scope(*this, S, /*AsInlined=*/true);
@@ -3953,6 +3941,28 @@ void CodeGenFunction::EmitOMPTeamsDistributeParallelForDirective(
[](CodeGenFunction &) { return nullptr; });
}
+void CodeGenFunction::EmitOMPTeamsDistributeParallelForSimdDirective(
+ const OMPTeamsDistributeParallelForSimdDirective &S) {
+ auto &&CodeGenDistribute = [&S](CodeGenFunction &CGF, PrePostActionTy &) {
+ CGF.EmitOMPDistributeLoop(S, emitInnerParallelForWhenCombined,
+ S.getDistInc());
+ };
+
+ // Emit teams region as a standalone region.
+ auto &&CodeGen = [&S, &CodeGenDistribute](CodeGenFunction &CGF,
+ PrePostActionTy &) {
+ OMPPrivateScope PrivateScope(CGF);
+ CGF.EmitOMPReductionClauseInit(S, PrivateScope);
+ (void)PrivateScope.Privatize();
+ CGF.CGM.getOpenMPRuntime().emitInlinedDirective(
+ CGF, OMPD_distribute, CodeGenDistribute, /*HasCancel=*/false);
+ CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_teams);
+ };
+ emitCommonOMPTeamsDirective(*this, S, OMPD_distribute_parallel_for, CodeGen);
+ emitPostUpdateForReductionClause(*this, S,
+ [](CodeGenFunction &) { return nullptr; });
+}
+
void CodeGenFunction::EmitOMPCancellationPointDirective(
const OMPCancellationPointDirective &S) {
CGM.getOpenMPRuntime().emitCancellationPointCall(*this, S.getLocStart(),
OpenPOWER on IntegriCloud