[OpenMP] Add an additional test for D34888
authorGheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com>
Tue, 26 Sep 2017 18:12:12 +0000 (18:12 +0000)
committerGheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com>
Tue, 26 Sep 2017 18:12:12 +0000 (18:12 +0000)
Summary: Test for checking if the mapping is performed correctly. This is a test initially included in Patch https://reviews.llvm.org/D29905

Reviewers: Hahnfeld, carlo.bertolli, caomhin

Reviewed By: Hahnfeld

Subscribers: tra, cfe-commits

Differential Revision: https://reviews.llvm.org/D38040

llvm-svn: 314228

clang/test/OpenMP/target_map_codegen.cpp

index 460a02e..7fde98d 100644 (file)
@@ -4554,3 +4554,33 @@ void explicit_maps_member_pointer_references(SSA *sap) {
 }
 #endif
 #endif
+
+///==========================================================================///
+// RUN: %clang -DCK30 -std=c++11 -fopenmp -S -emit-llvm -fopenmp-targets=nvptx64-nvidia-cuda \
+// RUN: -nocudalib %s -o - 2>&1 | FileCheck -check-prefix=CK30 %s
+
+#ifdef CK30
+
+void target_maps_parallel_integer(int a){
+  int ParamToKernel = a;
+#pragma omp target map(tofrom: ParamToKernel)
+  {
+    ParamToKernel += 1;
+  }
+}
+
+// CK30: {{.*}}void @__omp_offloading_{{.*}}(i32* dereferenceable(4) %ParamToKernel)
+
+// CK30: {{.*}}void {{.*}}target_maps_parallel_integer{{.*}} {
+
+// CK30: [[GEPOBP:%.+]] = getelementptr inbounds {{.*}}offload_baseptrs
+// CK30: [[GEPOBPBIT:%.+]] = bitcast i8** [[GEPOBP]]
+// CK30: store i32* %ParamToKernel, i32** [[GEPOBPBIT]]
+// CK30: [[GEPOP:%.+]] = getelementptr inbounds {{.*}}offload_ptrs
+// CK30: [[GEPOPBIT:%.+]] = bitcast i8** [[GEPOP]]
+// CK30: store i32* %ParamToKernel, i32** [[GEPOPBIT]]
+// CK30: [[GEPOBPARG:%.+]] = getelementptr inbounds {{.*}}offload_baseptrs
+// CK30: [[GEPOPARG:%.+]] = getelementptr inbounds {{.*}}offload_ptrs
+// CK30: call {{.*}}tgt_target({{.*}}i8** [[GEPOBPARG]], i8** [[GEPOPARG]]
+
+#endif