gcc/libgomp/testsuite/libgomp.c++/target-2.C
Tom de Vries f8e89d9f4d Run testsuite/libgomp.c++/c++.exp at -O2 by default
2015-06-30  Tom de Vries  <tom@codesourcery.com>

	* testsuite/libgomp.c++/c++.exp: Set DEFAULT_CFLAGS to -O2 if not
	already set.  Use DEFAULT_CFLAGS in dg-runtest.
	* testsuite/libgomp.c++/atomic-16.C: Remove dg-options "-O2 -fopenmp".
	* testsuite/libgomp.c++/pr64824.C: Same.
	* testsuite/libgomp.c++/pr64868.C: Same.
	* testsuite/libgomp.c++/pr66199-1.C: Same.
	* testsuite/libgomp.c++/pr66199-2.C: Same.
	* testsuite/libgomp.c++/target-2.C: Same.
	* testsuite/libgomp.c++/for-7.C: Use dg-additional-options for
	-std=<standard> option.
	* testsuite/libgomp.c++/udr-11.C: Same.
	* testsuite/libgomp.c++/udr-12.C: Same.
	* testsuite/libgomp.c++/udr-13.C: Same.
	* testsuite/libgomp.c++/udr-14.C: Same.
	* testsuite/libgomp.c++/udr-15.C: Same.
	* testsuite/libgomp.c++/udr-16.C: Same.
	* testsuite/libgomp.c++/udr-17.C: Same.
	* testsuite/libgomp.c++/udr-18.C: Same.
	* testsuite/libgomp.c++/udr-19.C: Same.
	* testsuite/libgomp.c++/atomic-1.C: Remove dg-options "-O2".
	* testsuite/libgomp.c++/simd-1.C: Same.
	* testsuite/libgomp.c++/simd-2.C: Same.
	* testsuite/libgomp.c++/simd-3.C: Same.
	* testsuite/libgomp.c++/simd-4.C: Same.
	* testsuite/libgomp.c++/simd-5.C: Same.
	* testsuite/libgomp.c++/simd-6.C: Same.
	* testsuite/libgomp.c++/simd-7.C: Same.
	* testsuite/libgomp.c++/simd-8.C: Same.
	* testsuite/libgomp.c++/simd-9.C: Same.
	* testsuite/libgomp.c++/simd10.C: Same.
	* testsuite/libgomp.c++/simd11.C: Same.
	* testsuite/libgomp.c++/simd12.C: Same.
	* testsuite/libgomp.c++/simd13.C: Same.

From-SVN: r225181
2015-06-30 12:22:04 +00:00

58 lines
1.1 KiB
C

// { dg-additional-sources "target-2-aux.cc" }
extern "C" void abort (void);
void
fn1 (double *x, double *y, int z)
{
int i;
for (i = 0; i < z; i++)
{
x[i] = i & 31;
y[i] = (i & 63) - 30;
}
}
double b[1024];
double (&br) [1024] = b;
double cbuf[1024];
double *c = cbuf;
double *&cr = c;
extern double (&fr) [1024];
extern double *&gr;
double
fn2 (int x, double (&dr) [1024], double *&er)
{
double s = 0;
double h[1024];
double (&hr) [1024] = h;
double ibuf[1024];
double *i = ibuf;
double *&ir = i;
int j;
fn1 (hr + 2 * x, ir + 2 * x, x);
#pragma omp target map(to: br[:x], cr[0:x], dr[x:x], er[x:x]) \
map(to: fr[0:x], gr[0:x], hr[2 * x:x], ir[2 * x:x])
#pragma omp parallel for reduction(+:s)
for (j = 0; j < x; j++)
s += br[j] * cr[j] + dr[x + j] + er[x + j]
+ fr[j] + gr[j] + hr[2 * x + j] + ir[2 * x + j];
return s;
}
int
main ()
{
double d[1024];
double ebuf[1024];
double *e = ebuf;
fn1 (br, cr, 128);
fn1 (d + 128, e + 128, 128);
fn1 (fr, gr, 128);
double h = fn2 (128, d, e);
if (h != 20416.0)
abort ();
return 0;
}