Go to file
Alexey Bataev a89adf22db [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
2015-04-27 05:04:13 +00:00
clang [OPENMP] Codegen for 'reduction' clause in 'sections' directive. 2015-04-27 05:04:13 +00:00
clang-tools-extra Fix clang-tools-extra build after clang r235614. 2015-04-23 20:38:48 +00:00
compiler-rt [Msan] Fix the iconv.cc test to build and pass on FreeBSD 2015-04-25 11:07:05 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc Fix compilation warnings without cl_khr_fp64 2015-04-24 19:54:17 +00:00
libcxx Fixed an 'extra tokens at end of #endif directive' warning in experimental/ratio 2015-04-23 16:45:08 +00:00
libcxxabi libc++abi: remove unused variable 2015-04-27 02:21:57 +00:00
libunwind unwind: clean up warnings from the build 2015-04-25 02:06:15 +00:00
lld Use MemoryBufferRef instead of MemoryBuffer&. NFC. 2015-04-24 21:10:50 +00:00
lldb Add SBLaunchInfo in include/lldb/API/SBDefines.h and fix spacing in scripts/Python/buildSwigPython.py 2015-04-26 07:51:14 +00:00
llgo [llgo] add buildbot-slave config 2015-04-08 01:41:46 +00:00
llvm [PerformanceTips] Italics are *word*, not _word_ 2015-04-26 22:25:29 +00:00
openmp updated copyright date to 2015 2015-04-16 11:10:17 +00:00
polly Use all available range information for parameters 2015-04-26 20:07:21 +00:00