Re: [patch] OpenACC fortran tests

2014-11-10 Thread Tobias Burnus

Cesar Philippidis wrote:

This patch contains compile-time tests for OpenACC in gfortran. Is this
patch OK for mainline trunk after the OpenACC fortran front end changes
make their way in?


I browsed the test cases – and they look okay. I didn't try hard to see 
whether every single one is valid nor whether some are missing, but my 
hope is that most of those issues were caught during the branch review.



NOTE: There is one

+!  FIXME: This causes an ICE in the gimplifier.

and for nonexpanding a builtin:

+! TODO: not working.

and

+! TODO: nested kernels are allowed in 2.0

and additionally - related to OpenACC's cache

+! TODO: These cases must fail


Unless the ICE is fixed until the commit, I would suggest to fill a PR 
for it to make sure it won't be forgotten. (One should probably add an 
"openacc" keyword.) And "cache" and nonnested kernels look like items 
for the release notes.


Thanks for the test cases to everyone involved!

Tobias


[patch] OpenACC fortran tests

2014-11-06 Thread Cesar Philippidis
This patch contains compile-time tests for OpenACC in gfortran. Is this
patch OK for mainline trunk after the OpenACC fortran front end changes
make their way in?

The fortran front end changes can be found here:

https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00553.html

Thanks,
Cesar
2014-11-06  Cesar Philippidis  
	Thomas Schwinge  
	Ilmir Usmanov  

	gcc/testsuite/
	* gfortran.dg/goacc/acc_on_device-1.f95: New test.
	* gfortran.dg/goacc/acc_on_device-2-off.f95: New test.
	* gfortran.dg/goacc/acc_on_device-2.f95: New test.
	* gfortran.dg/goacc/assumed.f95: New test.
	* gfortran.dg/goacc/asyncwait-1.f95: New test.
	* gfortran.dg/goacc/asyncwait-2.f95: New test.
	* gfortran.dg/goacc/asyncwait-3.f95: New test.
	* gfortran.dg/goacc/asyncwait-4.f95: New test.
	* gfortran.dg/goacc/branch.f95: New test.
	* gfortran.dg/goacc/cache-1.f95: New test.
	* gfortran.dg/goacc/coarray.f95: New test.
	* gfortran.dg/goacc/continuation-free-form.f95: New test.
	* gfortran.dg/goacc/cray.f95: New test.
	* gfortran.dg/goacc/critical.f95: New test.
	* gfortran.dg/goacc/data-clauses.f95: New test.
	* gfortran.dg/goacc/data-tree.f95: New test.
	* gfortran.dg/goacc/declare-1.f95: New test.
	* gfortran.dg/goacc/enter-exit-data.f95: New test.
	* gfortran.dg/goacc/fixed-1.f: New test.
	* gfortran.dg/goacc/fixed-2.f: New test.
	* gfortran.dg/goacc/fixed-3.f: New test.
	* gfortran.dg/goacc/fixed-4.f: New test.
	* gfortran.dg/goacc/goacc.exp: New test.
	* gfortran.dg/goacc/host_data-tree.f95: New test.
	* gfortran.dg/goacc/if.f95: New test.
	* gfortran.dg/goacc/kernels-tree.f95: New test.
	* gfortran.dg/goacc/list.f95: New test.
	* gfortran.dg/goacc/literal.f95: New test.
	* gfortran.dg/goacc/loop-1.f95: New test.
	* gfortran.dg/goacc/loop-2.f95: New test.
	* gfortran.dg/goacc/loop-3.f95: New test.
	* gfortran.dg/goacc/loop-tree-1.f90: New test.
	* gfortran.dg/goacc/omp.f95: New test.
	* gfortran.dg/goacc/parallel-kernels-clauses.f95: New test.
	* gfortran.dg/goacc/parallel-kernels-regions.f95: New test.
	* gfortran.dg/goacc/parallel-tree.f95: New test.
	* gfortran.dg/goacc/parameter.f95: New test.
	* gfortran.dg/goacc/private-1.f95: New test.
	* gfortran.dg/goacc/private-2.f95: New test.
	* gfortran.dg/goacc/private-3.f95: New test.
	* gfortran.dg/goacc/pure-elemental-procedures.f95: New test.
	* gfortran.dg/goacc/reduction-2.f95: New test.
	* gfortran.dg/goacc/reduction.f95: New test.
	* gfortran.dg/goacc/routine-1.f90: New test.
	* gfortran.dg/goacc/routine-2.f90: New test.
	* gfortran.dg/goacc/sentinel-free-form.f95: New test.
	* gfortran.dg/goacc/several-directives.f95: New test.
	* gfortran.dg/goacc/sie.f95: New test.
	* gfortran.dg/goacc/subarrays.f95: New test.


diff --git a/gcc/testsuite/gfortran.dg/goacc/acc_on_device-1.f95 b/gcc/testsuite/gfortran.dg/goacc/acc_on_device-1.f95
new file mode 100644
index 000..9dfde26
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/acc_on_device-1.f95
@@ -0,0 +1,22 @@
+! Have to enable optimizations, as otherwise builtins won't be expanded.
+! { dg-additional-options "-O -fdump-rtl-expand" }
+
+logical function f ()
+  implicit none
+
+  external acc_on_device
+  logical (4) acc_on_device
+
+  f = .false.
+  f = f .or. acc_on_device ()
+  f = f .or. acc_on_device (1, 2)
+  f = f .or. acc_on_device (3.14)
+  f = f .or. acc_on_device ("hello")
+
+  return
+end function f
+
+! Unsuitable to be handled as a builtin, so we're expecting four calls.
+! { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]*\\\"acc_on_device" 4 "expand" } }
+
+! { dg-final { cleanup-rtl-dump "expand" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/acc_on_device-2-off.f95 b/gcc/testsuite/gfortran.dg/goacc/acc_on_device-2-off.f95
new file mode 100644
index 000..cf28264
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/acc_on_device-2-off.f95
@@ -0,0 +1,39 @@
+! Have to enable optimizations, as otherwise builtins won't be expanded.
+! { dg-additional-options "-O -fdump-rtl-expand -fno-openacc" }
+
+module openacc_kinds
+  implicit none
+
+  integer, parameter :: acc_device_kind = 4
+
+end module openacc_kinds
+
+module openacc
+  use openacc_kinds
+  implicit none
+
+  integer (acc_device_kind), parameter :: acc_device_host = 2
+
+  interface
+ function acc_on_device (dev)
+   use openacc_kinds
+   logical (4) :: acc_on_device
+   integer (acc_device_kind), intent (in) :: dev
+ end function acc_on_device
+  end interface
+end module openacc
+
+logical (4) function f ()
+  use openacc
+  implicit none
+
+  integer (4), parameter :: dev = 2
+
+  f = acc_on_device (dev)
+  return
+end function f
+
+! Without -fopenacc, we're expecting one call.
+! { dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]*\\\"acc_on_device" 1 "expand" } }
+
+! { dg-final { cleanup-rtl-dump "expand" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/acc_on_device-2.f95 b/gcc/testsuite/gfortran.dg/goacc/acc_on_device-2.f95
new file mode 100644
index 000..7730a60
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/g