llvm-project/clang/lib
Alexey Bataev 794ba0dcb7 [OPENMP] Codegen for 'reduction' clause in 'parallel' 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>]) {
  ...
  *(Type<i> *)lhs[i] = RedOp<i>(*(Type<i> *)lhs[i], *(Type<i> *)rhs[i]);
  ...
}

... void *RedList[<n>] = {&<RHSExprs>[0], ..., &<RHSExprs>[<n> - 1]};
switch (__kmpc_reduce{_nowait}(<loc>, <gtid>, <n>, sizeof(RedList), RedList, reduce_func, &<lock>)) {
case 1:
  ...
  <LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]);
  ...
  __kmpc_end_reduce{_nowait}(<loc>, <gtid>, &<lock>);
  break;
case 2:
  ...
  Atomic(<LHSExprs>[i] = RedOp<i>(*<LHSExprs>[i], *<RHSExprs>[i]));
  ...
  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.

Differential Revision: http://reviews.llvm.org/D8915

llvm-svn: 234583
2015-04-10 10:43:45 +00:00
..
ARCMigrate [Objective-C SDK modernizer]. Patch to convert setter/getter 2015-04-02 21:36:03 +00:00
AST [OPENMP] Codegen for 'reduction' clause in 'parallel' directive. 2015-04-10 10:43:45 +00:00
ASTMatchers ASTMatchers: Add an explicit dependency on libclangBasic. 2015-03-12 16:25:19 +00:00
Analysis Take the non-reference type when constructing a dummy expression. 2015-03-16 21:49:43 +00:00
Basic Add Clang support for remaining integer divide and permute instructions from ISA 2.06 2015-04-09 23:58:16 +00:00
CodeGen [OPENMP] Codegen for 'reduction' clause in 'parallel' directive. 2015-04-10 10:43:45 +00:00
Driver [ASan] Don't link against libc++abi when not using libc++ 2015-04-09 18:47:01 +00:00
Edit [edit] Don't hit an assert when trying to delete a trailing space at EOF 2015-03-29 18:07:29 +00:00
Format clang-format: Fix regression formatting QT's "signals:" from r234318. 2015-04-07 15:04:40 +00:00
Frontend [Objective-C modern translation]. Patch to fix type of 2015-04-09 18:36:50 +00:00
FrontendTool Provide a BuryPointer for unique_ptrs. 2014-08-29 16:53:14 +00:00
Headers _mm256_blend_epi16 is being cast to __m256d instead of __m256i. Fixing this. 2015-04-10 02:39:45 +00:00
Index [libclang] Use same USR encoding for 'char' regardless of what the target considers the sign to be. 2014-12-08 09:09:05 +00:00
Lex MSan told me that we actually dump the entire scratch buffer into PCH files, initialize it. 2015-04-06 20:01:49 +00:00
Parse Correct typos in SEH filter expressions 2015-04-02 22:09:32 +00:00
Rewrite [Rewrite] Make RewriteBuffer accessible on its own, and add a unit test for it. 2015-03-08 04:00:33 +00:00
Sema [OPENMP] Codegen for 'reduction' clause in 'parallel' directive. 2015-04-10 10:43:45 +00:00
Serialization [OPENMP] Codegen for 'reduction' clause in 'parallel' directive. 2015-04-10 10:43:45 +00:00
StaticAnalyzer [analyzer] Disable all retain count diagnostics on values that come from ivars. 2015-03-30 20:18:00 +00:00
Tooling Make the clang-fuzzer use the CompilerInstance directly. 2015-03-28 00:42:36 +00:00
CMakeLists.txt Fix build with various feature flag combinations 2014-07-14 22:17:22 +00:00
Makefile Make clang's rewrite engine a core feature 2014-07-16 16:48:33 +00:00