r334962 - [OPENMP, NVPTX] Emit simple reduction if requested.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 18 10:11:45 PDT 2018


Author: abataev
Date: Mon Jun 18 10:11:45 2018
New Revision: 334962

URL: http://llvm.org/viewvc/llvm-project?rev=334962&view=rev
Log:
[OPENMP, NVPTX] Emit simple reduction if requested.

If simple reduction is requested, use the simple reduction instead of
the runtime functions calls.

Modified:
    cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
    cfe/trunk/test/OpenMP/nvptx_target_simd_codegen.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp?rev=334962&r1=334961&r2=334962&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp Mon Jun 18 10:11:45 2018
@@ -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.

Modified: cfe/trunk/test/OpenMP/nvptx_target_simd_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nvptx_target_simd_codegen.cpp?rev=334962&r1=334961&r2=334962&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/nvptx_target_simd_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/nvptx_target_simd_codegen.cpp Mon Jun 18 10:11:45 2018
@@ -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
 




More information about the cfe-commits mailing list