diff options
author | Andrew Stubbs <ams@codesourcery.com> | 2019-11-15 10:49:10 +0000 |
---|---|---|
committer | Andrew Stubbs <ams@gcc.gnu.org> | 2019-11-15 10:49:10 +0000 |
commit | 8916ba874dae00edc04face497360ce4eb3ea95b (patch) | |
tree | c185795f068e612f943bd9b125df62b5e65ada28 | |
parent | 3739bcc8c8e1c532223af7d8870be11fb5c7dac4 (diff) | |
download | gcc-8916ba874dae00edc04face497360ce4eb3ea95b.zip gcc-8916ba874dae00edc04face497360ce4eb3ea95b.tar.gz gcc-8916ba874dae00edc04face497360ce4eb3ea95b.tar.bz2 |
Add tests for print from offload target.
2019-11-15 Andrew Stubbs <ams@codesourcery.com>
libgomp/
* testsuite/libgomp.c/target-print-1.c: New file.
* testsuite/libgomp.fortran/target-print-1.f90: New file.
* testsuite/libgomp.oacc-c/print-1.c: New file.
* testsuite/libgomp.oacc-fortran/print-1.f90: New file.
From-SVN: r278284
-rw-r--r-- | libgomp/ChangeLog | 7 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/target-print-1.c | 17 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.fortran/target-print-1.f90 | 15 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-c/print-1.c | 17 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 | 15 |
5 files changed, 71 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index bcd14fa..afea495 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,10 @@ +2019-11-15 Andrew Stubbs <ams@codesourcery.com> + + * testsuite/libgomp.c/target-print-1.c: New file. + * testsuite/libgomp.fortran/target-print-1.f90: New file. + * testsuite/libgomp.oacc-c/print-1.c: New file. + * testsuite/libgomp.oacc-fortran/print-1.f90: New file. + 2019-11-13 Andrew Stubbs <ams@codesourcery.com> Kwok Cheung Yeung <kcy@codesourcery.com> Julian Brown <julian@codesourcery.com> diff --git a/libgomp/testsuite/libgomp.c/target-print-1.c b/libgomp/testsuite/libgomp.c/target-print-1.c new file mode 100644 index 0000000..5857b87 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-print-1.c @@ -0,0 +1,17 @@ +/* Ensure that printf on the offload device works. */ + +/* { dg-do run } */ +/* { dg-output "The answer is 42(\n|\r\n|\r)+" } */ + +#include <stdio.h> + +int var = 42; + +int +main () +{ +#pragma omp target + { + printf ("The answer is %d\n", var); + } +} diff --git a/libgomp/testsuite/libgomp.fortran/target-print-1.f90 b/libgomp/testsuite/libgomp.fortran/target-print-1.f90 new file mode 100644 index 0000000..c71a095 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-print-1.f90 @@ -0,0 +1,15 @@ +! Ensure that printf on the offload device works. + +! { dg-do run } +! { dg-output "The answer is 42(\n|\r\n|\r)+" } +! { dg-xfail-if "no write for nvidia" { openacc_nvidia_accel_selected } } + +program main + implicit none + integer :: var = 42 + +!$omp target + write (0, '("The answer is ", I2)') var +!$omp end target + +end program main diff --git a/libgomp/testsuite/libgomp.oacc-c/print-1.c b/libgomp/testsuite/libgomp.oacc-c/print-1.c new file mode 100644 index 0000000..593885b --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c/print-1.c @@ -0,0 +1,17 @@ +/* Ensure that printf on the offload device works. */ + +/* { dg-do run } */ +/* { dg-output "The answer is 42(\n|\r\n|\r)+" } */ + +#include <stdio.h> + +int var = 42; + +int +main () +{ +#pragma acc parallel + { + printf ("The answer is %d\n", var); + } +} diff --git a/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 new file mode 100644 index 0000000..a83280d --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/print-1.f90 @@ -0,0 +1,15 @@ +! Ensure that printf on the offload device works. + +! { dg-do run } +! { dg-output "The answer is 42(\n|\r\n|\r)+" } +! { dg-xfail-if "no write for nvidia" { openacc_nvidia_accel_selected } } + +program main + implicit none + integer :: var = 42 + +!$acc parallel + write (0, '("The answer is ", I2)') var +!$acc end parallel + +end program main |