gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/declare-4.c
Tom de Vries 92d5d01ac6 Enable libgomp.oacc-*/declare-*.{c,f90} for non-nvidia devices
2017-10-16  Tom de Vries  <tom@codesourcery.com>

	* testsuite/libgomp.oacc-c-c++-common/declare-1.c: Don't require
	openacc_nvidia_accel_selected.
	* testsuite/libgomp.oacc-c-c++-common/declare-2.c: Same.
	* testsuite/libgomp.oacc-c-c++-common/declare-4.c: Same.
	* testsuite/libgomp.oacc-fortran/declare-2.f90: Same.
	* testsuite/libgomp.oacc-fortran/declare-4.f90: Same
	* testsuite/libgomp.oacc-fortran/declare-5.f90: Same.
	* testsuite/libgomp.oacc-c-c++-common/declare-5.c: Don't require
	openacc_nvidia_accel_selected. Skip for shared memory device.
	* testsuite/libgomp.oacc-fortran/declare-1.f90: Same.
	* testsuite/libgomp.oacc-fortran/declare-3.f90: Same.

From-SVN: r253779
2017-10-16 08:44:42 +00:00

40 lines
381 B
C

#include <stdlib.h>
#include <openacc.h>
float b;
#pragma acc declare create (b)
#pragma acc routine
int
func (int a)
{
b = a + 1;
return b;
}
int
main (int argc, char **argv)
{
float a;
a = 2.0;
#pragma acc parallel copy (a)
{
b = a;
a = 1.0;
a = a + b;
}
if (a != 3.0)
abort ();
a = func (a);
if (a != 4.0)
abort ();
return 0;
}