]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add 'libgomp.{,oacc-}fortran/fortran-torture_execute_math.f90'
authorThomas Schwinge <thomas@codesourcery.com>
Fri, 2 Jun 2023 21:11:00 +0000 (23:11 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Wed, 14 Jun 2023 09:41:45 +0000 (11:41 +0200)
..., via 'include'ing the existing 'gfortran.fortran-torture/execute/math.f90',
which therefore is enhanced for optional OpenACC 'serial', OpenMP 'target'
usage.

gcc/testsuite/
* gfortran.fortran-torture/execute/math.f90: Enhance for optional
OpenACC 'serial', OpenMP 'target' usage.
libgomp/
* testsuite/libgomp.fortran/fortran-torture_execute_math.f90: New.
* testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90:
Likewise.

gcc/testsuite/gfortran.fortran-torture/execute/math.f90
libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 [new file with mode: 0644]

index 17cc78f7a10525f93d29f3233d64d9c1c179eb22..6c97eba3f8ff6bd338e1505964b7eb1d3d26a846 100644 (file)
@@ -1,9 +1,15 @@
 ! Program to test mathematical intrinsics
+
+! This file is also 'include'd in:
+!   - 'libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90' (thus the '!$omp' directives)
+!   - 'libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90' (thus the '!$acc' directives)
+
 subroutine dotest (n, val4, val8, known)
    implicit none
    real(kind=4) val4, known
    real(kind=8) val8
    integer n
+   !$acc routine seq
 
    if (abs (val4 - known) .gt. 0.001) STOP 1
    if (abs (real (val8, kind=4) - known) .gt. 0.001) STOP 2
@@ -14,17 +20,20 @@ subroutine dotestc (n, val4, val8, known)
    complex(kind=4) val4, known
    complex(kind=8) val8
    integer n
+   !$acc routine seq
+
    if (abs (val4 - known) .gt. 0.001) STOP 3
    if (abs (cmplx (val8, kind=4) - known) .gt. 0.001) STOP 4
 end subroutine
 
-program testmath
+subroutine testmath
    implicit none
    real(kind=4) r, two4, half4
    real(kind=8) q, two8, half8
    complex(kind=4) cr
    complex(kind=8) cq
    external dotest, dotestc
+   !$acc routine seq
 
    two4 = 2.0
    two8 = 2.0_8
@@ -96,5 +105,16 @@ program testmath
    cq = log ((-1.0_8, -1.0_8))
    call dotestc (21, cr, cq, (0.3466, -2.3562))
 
-end program
+end subroutine
 
+program main
+   implicit none
+   external testmath
+
+   !$acc serial
+   !$omp target
+   call testmath
+   !$acc end serial
+   !$omp end target
+
+end program
diff --git a/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.fortran/fortran-torture_execute_math.f90
new file mode 100644 (file)
index 0000000..3348a0b
--- /dev/null
@@ -0,0 +1,4 @@
+! { dg-do run }
+! { dg-additional-options -foffload-options=-lm }
+
+include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90 b/libgomp/testsuite/libgomp.oacc-fortran/fortran-torture_execute_math.f90
new file mode 100644 (file)
index 0000000..1b2ac44
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do run }
+!TODO { dg-prune-output {using 'vector_length \(32\)', ignoring 1} }
+! { dg-additional-options -foffload-options=-lm }
+
+include '../../../gcc/testsuite/gfortran.fortran-torture/execute/math.f90'