summaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c++
diff options
context:
space:
mode:
authorkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-13 13:56:22 +0000
committerkyukhin <kyukhin@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-13 13:56:22 +0000
commit235252169de1e457e96d4fcd0e58a2638dc84b67 (patch)
treed2c1d75d58f000bd59c8eac757bb91fc0f5c3b0c /libgomp/testsuite/libgomp.c++
parent38e21583d174a96a85786dd8d63d465e9e9e3391 (diff)
downloadgcc-235252169de1e457e96d4fcd0e58a2638dc84b67.tar.gz
[PATCH 7/7] OpenMP 4.0 offloading infrastructure: testsuite.
libgomp/ * testsuite/lib/libgomp.exp (check_effective_target_offload_device): New. * testsuite/libgomp.c++/c++.exp: Include tests from subdirectories. * testsuite/libgomp.c++/examples-4/e.51.5.C: New test. * testsuite/libgomp.c++/examples-4/e.53.2.C: Ditto. * testsuite/libgomp.c/examples-4/e.50.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.6.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.7.c: Ditto. * testsuite/libgomp.c/examples-4/e.52.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.52.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.6.c: Ditto. * testsuite/libgomp.c/examples-4/e.55.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.55.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.56.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.56.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.3.c: Ditto. * testsuite/libgomp.c/target-7.c: Fix test. * testsuite/libgomp.fortran/examples-4/e.50.1.f90: New test. * testsuite/libgomp.fortran/examples-4/e.50.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.6.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.7.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.52.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.52.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.6.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.55.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.55.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.56.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.56.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.3.f90: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217494 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp/testsuite/libgomp.c++')
-rw-r--r--libgomp/testsuite/libgomp.c++/c++.exp2
-rw-r--r--libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C62
-rw-r--r--libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C43
3 files changed, 106 insertions, 1 deletions
diff --git a/libgomp/testsuite/libgomp.c++/c++.exp b/libgomp/testsuite/libgomp.c++/c++.exp
index a9cf41aba4b..da42e6213b0 100644
--- a/libgomp/testsuite/libgomp.c++/c++.exp
+++ b/libgomp/testsuite/libgomp.c++/c++.exp
@@ -42,7 +42,7 @@ if { $blddir != "" } {
if { $lang_test_file_found } {
# Gather a list of all tests.
- set tests [lsort [glob -nocomplain $srcdir/$subdir/*.C]]
+ set tests [lsort [find $srcdir/$subdir *.C]]
if { $blddir != "" } {
set ld_library_path "$always_ld_library_path:${blddir}/${lang_library_path}"
diff --git a/libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C b/libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C
new file mode 100644
index 00000000000..4298e234217
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/examples-4/e.51.5.C
@@ -0,0 +1,62 @@
+// { dg-do run }
+
+#include <omp.h>
+
+#define EPS 0.000001
+#define N 1000
+
+extern "C" void abort (void);
+
+void init (float *a1, float *a2, int n)
+{
+ int s = -1;
+ for (int i = 0; i < n; i++)
+ {
+ a1[i] = s * 0.01;
+ a2[i] = i;
+ s = -s;
+ }
+}
+
+void check (float *a, float *b, int n)
+{
+ for (int i = 0; i < n; i++)
+ if (a[i] - b[i] > EPS || b[i] - a[i] > EPS)
+ abort ();
+}
+
+void vec_mult_ref (float *&p, float *&v1, float *&v2, int n)
+{
+ for (int i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+void vec_mult (float *&p, float *&v1, float *&v2, int n)
+{
+ #pragma omp target map(to: v1[0:n], v2[:n]) map(from: p[0:n])
+ #pragma omp parallel for
+ for (int i = 0; i < n; i++)
+ p[i] = v1[i] * v2[i];
+}
+
+int main ()
+{
+ float *p = new float [N];
+ float *p1 = new float [N];
+ float *v1 = new float [N];
+ float *v2 = new float [N];
+
+ init (v1, v2, N);
+
+ vec_mult_ref (p, v1, v2, N);
+ vec_mult (p1, v1, v2, N);
+
+ check (p, p1, N);
+
+ delete [] p;
+ delete [] p1;
+ delete [] v1;
+ delete [] v2;
+
+ return 0;
+}
diff --git a/libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C b/libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C
new file mode 100644
index 00000000000..75276e7c5c6
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/examples-4/e.53.2.C
@@ -0,0 +1,43 @@
+// { dg-do run }
+// { dg-require-effective-target offload_device }
+
+#include <stdlib.h>
+
+struct typeX
+{
+ int a;
+};
+
+class typeY
+{
+public:
+ int foo () { return a^0x01; }
+ int a;
+};
+
+#pragma omp declare target
+struct typeX varX;
+class typeY varY;
+#pragma omp end declare target
+
+int main ()
+{
+ varX.a = 0;
+ varY.a = 0;
+
+ #pragma omp target
+ {
+ varX.a = 100;
+ varY.a = 100;
+ }
+
+ if (varX.a != 0 || varY.a != 0)
+ abort ();
+
+ #pragma omp target update from(varX, varY)
+
+ if (varX.a != 100 || varY.a != 100)
+ abort ();
+
+ return 0;
+}