aboutsummaryrefslogtreecommitdiff
path: root/clang/test/OpenMP/taskwait_codegen.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-04-27 05:04:13 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-04-27 05:04:13 +0000
commita89adf22db0db5aaa561b20a5ae1845190c851a7 (patch)
treea4730f1c7d1cc88451de841c741d6382c6d3dfa4 /clang/test/OpenMP/taskwait_codegen.cpp
parent9efc03b6f7666e4d51627ed2e0198747769d091e (diff)
downloadllvm-a89adf22db0db5aaa561b20a5ae1845190c851a7.zip
llvm-a89adf22db0db5aaa561b20a5ae1845190c851a7.tar.gz
llvm-a89adf22db0db5aaa561b20a5ae1845190c851a7.tar.bz2
[OPENMP] Codegen for 'reduction' clause in 'sections' directive.
Emit a code for reduction clause. Next code should be emitted for reductions: static kmp_critical_name lock = { 0 }; void reduce_func(void *lhs[<n>], void *rhs[<n>]) { *(Type0*)lhs[0] = ReductionOperation0(*(Type0*)lhs[0], *(Type0*)rhs[0]); ... *(Type<n>-1*)lhs[<n>-1] = ReductionOperation<n>-1(*(Type<n>-1*)lhs[<n>-1], *(Type<n>-1*)rhs[<n>-1]); } ... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n>-1]}; switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) { case 1: <LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0]); ... <LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1]); __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>); break; case 2: Atomic(<LHSExprs>[0] = ReductionOperation0(*<LHSExprs>[0], *<RHSExprs>[0])); ... Atomic(<LHSExprs>[<n>-1] = ReductionOperation<n>-1(*<LHSExprs>[<n>-1], *<RHSExprs>[<n>-1])); break; default:; } Reduction variables are a kind of a private variables, they have private copies, but initial values are chosen in accordance with the reduction operation. If sections directive has only single section, then original shared variables are used instead with barrier at the end of the directive. Differential Revision: http://reviews.llvm.org/D9242 llvm-svn: 235835
Diffstat (limited to 'clang/test/OpenMP/taskwait_codegen.cpp')
0 files changed, 0 insertions, 0 deletions