[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-26 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 116747.
gtbercea added a comment.

Fix test.


https://reviews.llvm.org/D38040

Files:
  test/OpenMP/openmp_offload_codegen.cpp


Index: test/OpenMP/openmp_offload_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/openmp_offload_codegen.cpp
@@ -0,0 +1,36 @@
+// Test device for mapping codegen.
+///==///
+
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -S -emit-llvm 
%s -o - 2>&1 \
+// RUN:   | FileCheck -check-prefix=CK1 %s
+
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc 
%s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple 
powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s 
-fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck 
%s --check-prefix CK1-DEVICE
+
+// expected-no-diagnostics
+
+#ifdef CK1
+
+void target_maps_parallel_integer(int a){
+  int ParamToKernel = a;
+#pragma omp target map(tofrom: ParamToKernel)
+  {
+ParamToKernel += 1;
+  }
+}
+
+// CK1-DEVICE: {{.*}}void @__omp_offloading_{{.*}}(i32* 
dereferenceable(4){{.*}}
+
+// CK1: {{.*}}void {{.*}}target_maps_parallel_integer{{.*}} {
+
+// CK1: [[GEPOBP:%.+]] = getelementptr inbounds {{.*}}
+// CK1: [[GEPOBPBIT:%.+]] = bitcast i8** [[GEPOBP]]
+// CK1: store i32* %ParamToKernel, i32** [[GEPOBPBIT]]
+// CK1: [[GEPOP:%.+]] = getelementptr inbounds {{.*}}
+// CK1: [[GEPOPBIT:%.+]] = bitcast i8** [[GEPOP]]
+// CK1: store i32* %ParamToKernel, i32** [[GEPOPBIT]]
+// CK1: [[GEPOBPARG:%.+]] = getelementptr inbounds {{.*}}
+// CK1: [[GEPOPARG:%.+]] = getelementptr inbounds {{.*}}
+// CK1: call {{.*}}tgt_target({{.*}}i8** [[GEPOBPARG]], i8** [[GEPOPARG]]
+
+#endif
\ No newline at end of file


Index: test/OpenMP/openmp_offload_codegen.cpp
===
--- /dev/null
+++ test/OpenMP/openmp_offload_codegen.cpp
@@ -0,0 +1,36 @@
+// Test device for mapping codegen.
+///==///
+
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -S -emit-llvm %s -o - 2>&1 \
+// RUN:   | FileCheck -check-prefix=CK1 %s
+
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
+// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CK1-DEVICE
+
+// expected-no-diagnostics
+
+#ifdef CK1
+
+void target_maps_parallel_integer(int a){
+  int ParamToKernel = a;
+#pragma omp target map(tofrom: ParamToKernel)
+  {
+ParamToKernel += 1;
+  }
+}
+
+// CK1-DEVICE: {{.*}}void @__omp_offloading_{{.*}}(i32* dereferenceable(4){{.*}}
+
+// CK1: {{.*}}void {{.*}}target_maps_parallel_integer{{.*}} {
+
+// CK1: [[GEPOBP:%.+]] = getelementptr inbounds {{.*}}
+// CK1: [[GEPOBPBIT:%.+]] = bitcast i8** [[GEPOBP]]
+// CK1: store i32* %ParamToKernel, i32** [[GEPOBPBIT]]
+// CK1: [[GEPOP:%.+]] = getelementptr inbounds {{.*}}
+// CK1: [[GEPOPBIT:%.+]] = bitcast i8** [[GEPOP]]
+// CK1: store i32* %ParamToKernel, i32** [[GEPOPBIT]]
+// CK1: [[GEPOBPARG:%.+]] = getelementptr inbounds {{.*}}
+// CK1: [[GEPOPARG:%.+]] = getelementptr inbounds {{.*}}
+// CK1: call {{.*}}tgt_target({{.*}}i8** [[GEPOBPARG]], i8** [[GEPOPARG]]
+
+#endif
\ No newline at end of file
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-26 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea reopened this revision.
gtbercea added a comment.
This revision is now accepted and ready to land.

Open


https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-26 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 116671.
gtbercea added a comment.

Add nocudalib flag.


https://reviews.llvm.org/D38040

Files:
  test/OpenMP/target_map_codegen.cpp


Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4554,3 +4554,33 @@
 }
 #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


Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4554,3 +4554,33 @@
 }
 #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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-26 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea reopened this revision.
gtbercea added a comment.
This revision is now accepted and ready to land.

Open


https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-26 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld accepted this revision.
Hahnfeld added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-26 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 116664.
gtbercea added a comment.

Fix test.


https://reviews.llvm.org/D38040

Files:
  test/OpenMP/target_map_codegen.cpp


Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4554,3 +4554,33 @@
 }
 #endif
 #endif
+
+///==///
+// RUN: %clang -DCK30 -std=c++11 -fopenmp -S -emit-llvm 
-fopenmp-targets=nvptx64-nvidia-cuda %s -o - 2>&1 \
+// RUN: | 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


Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4554,3 +4554,33 @@
 }
 #endif
 #endif
+
+///==///
+// RUN: %clang -DCK30 -std=c++11 -fopenmp -S -emit-llvm -fopenmp-targets=nvptx64-nvidia-cuda %s -o - 2>&1 \
+// RUN: | 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
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-25 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea added a comment.

In https://reviews.llvm.org/D38040#878799, @Hahnfeld wrote:

> In https://reviews.llvm.org/D38040#878441, @gtbercea wrote:
>
> > The test is verifying whether the parameter is passed to the kernel 
> > correctly. I believe it was not passed as a reference before the patch.
>
>
> Ah, right: This isn't checked anywhere before. Maybe add a comment about 
> what's tested here?
>  Do we want to check the rest of the codegen with a focus that the variable 
> is passed as a reference?
>
> > In addition to that, something that was in my previous patch is related to 
> > this code:
> > 
> >   DSAStack->checkMappableExprComponentListsForDeclAtLevel(
> >   D, Level, 
> > [&](OMPClauseMappableExprCommon::MappableExprComponentListRef
> > 
> > 
> > In particular with the Level variable. Should the Level variable actually 
> > be Level + 1 in this case?
>
> I'm not sure, the current public `clang-ykt` has `Level`:  
> https://github.com/clang-ykt/clang/blob/d181aed/lib/Sema/SemaOpenMP.cpp#L1361


You're right!


Repository:
  rL LLVM

https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-22 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

In https://reviews.llvm.org/D38040#878441, @gtbercea wrote:

> The test is verifying whether the parameter is passed to the kernel 
> correctly. I believe it was not passed as a reference before the patch.


Ah, right: This isn't checked anywhere before. Maybe add a comment about what's 
tested here?
Do we want to check the rest of the codegen with a focus that the variable is 
passed as a reference?

> In addition to that, something that was in my previous patch is related to 
> this code:
> 
>   DSAStack->checkMappableExprComponentListsForDeclAtLevel(
>   D, Level, 
> [&](OMPClauseMappableExprCommon::MappableExprComponentListRef
> 
> 
> In particular with the Level variable. Should the Level variable actually be 
> Level + 1 in this case?

I'm not sure, the current public `clang-ykt` has `Level`:  
https://github.com/clang-ykt/clang/blob/d181aed/lib/Sema/SemaOpenMP.cpp#L1361


Repository:
  rL LLVM

https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-21 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea added a comment.

In https://reviews.llvm.org/D38040#878090, @Hahnfeld wrote:

> Hi Doru,
>
> if I remember correctly I submitted https://reviews.llvm.org/D34888 for a 
> crash when mapping a scalar value with nested regions.
>  I've marked another test in this file that the codegen for `tofrom` is 
> correct. So I don't know if this test checks some other conditions?
>
> Jonas


Hi Jonas,

The test is verifying whether the parameter is passed to the kernel correctly. 
I believe it was not passed as a reference before the patch.

In addition to that, something that was in my previous patch is related to this 
code:

  DSAStack->checkMappableExprComponentListsForDeclAtLevel(
  D, Level, 
[&](OMPClauseMappableExprCommon::MappableExprComponentListRef

In particular with the Level variable. Should the Level variable actually be 
Level + 1 in this case?

Thanks,

--Doru


Repository:
  rL LLVM

https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-21 Thread Jonas Hahnfeld via Phabricator via cfe-commits
Hahnfeld added a comment.

Hi Doru,

if I remember correctly I submitted https://reviews.llvm.org/D34888 for a crash 
when mapping a scalar value with nested regions.
I've marked another test in this file that the codegen for `tofrom` is correct. 
So I don't know if this test checks some other conditions?

Jonas




Comment at: test/OpenMP/target_map_codegen.cpp:1773
   // CK19: call void [[CALL23:@.+]](i32* {{[^,]+}})
   #pragma omp target map(always, tofrom: a)
   {

`tofrom` is tested here...


Repository:
  rL LLVM

https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-20 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments.



Comment at: test/OpenMP/target_map_codegen.cpp:4845
+///==///
+// RUN: %clang_cc1 -DCK30 -std=c++11 -fopenmp -S -emit-llvm -fopenmp 
-fopenmp-targets=nvptx64-nvidia-cuda %s -o - 2>&1 | FileCheck 
-check-prefix=CK30 %s
+

tra wrote:
> Please break the line to make it easier to read.
Better, but the line still wraps.  I'd split it again somewhere between 
-emit-llvm and -fopenmp.
BTW, you have -fopenmp specified twice. Is that intentional?


Repository:
  rL LLVM

https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-19 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea updated this revision to Diff 115947.

Repository:
  rL LLVM

https://reviews.llvm.org/D38040

Files:
  test/OpenMP/target_map_codegen.cpp


Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4840,3 +4840,21 @@
 }
 #endif
 #endif
+
+///==///
+// RUN: %clang_cc1 -DCK30 -std=c++11 -fopenmp -S -emit-llvm -fopenmp 
-fopenmp-targets=nvptx64-nvidia-cuda %s -o - 2>&1 \
+// RUN: | 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) #0 {
+
+#endif


Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4840,3 +4840,21 @@
 }
 #endif
 #endif
+
+///==///
+// RUN: %clang_cc1 -DCK30 -std=c++11 -fopenmp -S -emit-llvm -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda %s -o - 2>&1 \
+// RUN: | 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) #0 {
+
+#endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-19 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment.

LGTM in general.




Comment at: test/OpenMP/target_map_codegen.cpp:4845
+///==///
+// RUN: %clang_cc1 -DCK30 -std=c++11 -fopenmp -S -emit-llvm -fopenmp 
-fopenmp-targets=nvptx64-nvidia-cuda %s -o - 2>&1 | FileCheck 
-check-prefix=CK30 %s
+

Please break the line to make it easier to read.


Repository:
  rL LLVM

https://reviews.llvm.org/D38040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D38040: [OpenMP] Add an additional test for D34888

2017-09-19 Thread Gheorghe-Teodor Bercea via Phabricator via cfe-commits
gtbercea created this revision.

Test for checking if the mapping is performed correctly. This is a test 
initially included in Patch https://reviews.llvm.org/D29905


Repository:
  rL LLVM

https://reviews.llvm.org/D38040

Files:
  test/OpenMP/target_map_codegen.cpp


Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4840,3 +4840,20 @@
 }
 #endif
 #endif
+
+///==///
+// RUN: %clang_cc1 -DCK30 -std=c++11 -fopenmp -S -emit-llvm -fopenmp 
-fopenmp-targets=nvptx64-nvidia-cuda %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) #0 {
+
+#endif


Index: test/OpenMP/target_map_codegen.cpp
===
--- test/OpenMP/target_map_codegen.cpp
+++ test/OpenMP/target_map_codegen.cpp
@@ -4840,3 +4840,20 @@
 }
 #endif
 #endif
+
+///==///
+// RUN: %clang_cc1 -DCK30 -std=c++11 -fopenmp -S -emit-llvm -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda %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) #0 {
+
+#endif
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits