diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2018-06-18 17:11:45 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-06-18 17:11:45 +0000 |
commit | 7b55d2d5542545755ffd99069c98d0dc36495b04 (patch) | |
tree | f24a52d1e01a69b9b636abf225c4af46da3d736d /clang | |
parent | a88281d8ae3a6bb0c4da126910b9b30fe068ad55 (diff) | |
download | bcm5719-llvm-7b55d2d5542545755ffd99069c98d0dc36495b04.tar.gz bcm5719-llvm-7b55d2d5542545755ffd99069c98d0dc36495b04.zip |
[OPENMP, NVPTX] Emit simple reduction if requested.
If simple reduction is requested, use the simple reduction instead of
the runtime functions calls.
llvm-svn: 334962
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 6 | ||||
-rw-r--r-- | clang/test/OpenMP/nvptx_target_simd_codegen.cpp | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp index 785ed567606..9452bdea4c7 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -3163,6 +3163,12 @@ void CGOpenMPRuntimeNVPTX::emitReduction( assert((TeamsReduction || ParallelReduction || SimdReduction) && "Invalid reduction selection in emitReduction."); + if (Options.SimpleReduction) { + CGOpenMPRuntime::emitReduction(CGF, Loc, Privates, LHSExprs, RHSExprs, + ReductionOps, Options); + return; + } + ASTContext &C = CGM.getContext(); // 1. Build a list of reduction variables. diff --git a/clang/test/OpenMP/nvptx_target_simd_codegen.cpp b/clang/test/OpenMP/nvptx_target_simd_codegen.cpp index 5f307d8835e..89ea173addc 100644 --- a/clang/test/OpenMP/nvptx_target_simd_codegen.cpp +++ b/clang/test/OpenMP/nvptx_target_simd_codegen.cpp @@ -78,9 +78,8 @@ int bar(int n){ // CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) // CHECK-NOT: call void @__kmpc_for_static_init // CHECK-NOT: call void @__kmpc_for_static_fini -// CHECK: [[RES:%.+]] = call i32 @__kmpc_nvptx_simd_reduce_nowait(i32 %{{.+}}, i32 1, i{{64|32}} {{8|4}}, i8* %{{.+}}, void (i8*, i16, i16, i16)* @{{.+}}, void (i8*, i32)* @{{.+}}) -// CHECK: switch i32 [[RES]] -// CHECK: call void @__kmpc_nvptx_end_reduce_nowait(i32 %{{.+}}) +// CHECK-NOT: call i32 @__kmpc_nvptx_simd_reduce_nowait( +// CHECK-NOT: call void @__kmpc_nvptx_end_reduce_nowait( // CHECK: call void @__kmpc_kernel_deinit(i16 1) // CHECK: ret void |