diff options
author | Jakub Jelinek <jakub@redhat.com> | 2020-05-12 09:17:09 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2020-05-12 09:17:09 +0200 |
commit | dc703151d4f4560e647649506d5b4ceb0ee11e90 (patch) | |
tree | e0982957d9abe22aec71e6199d1e306e9b0795ab /libgomp | |
parent | fe8c8f1e5ed61f00c14ff36caf4f510a7a09781d (diff) | |
download | gcc-dc703151d4f4560e647649506d5b4ceb0ee11e90.zip gcc-dc703151d4f4560e647649506d5b4ceb0ee11e90.tar.gz gcc-dc703151d4f4560e647649506d5b4ceb0ee11e90.tar.bz2 |
openmp: Implement discovery of implicit declare target to clauses
This attempts to implement what the OpenMP 5.0 spec in declare target section
says as ammended by the 5.1 changes so far (related to device_type(host)), except
that it doesn't have the device(ancestor: ...) handling yet because we do not
support it yet, and I've left so far out the except lambda note, because I need
that clarified.
2020-05-12 Jakub Jelinek <jakub@redhat.com>
* omp-offload.h (omp_discover_implicit_declare_target): Declare.
* omp-offload.c: Include context.h.
(omp_declare_target_fn_p, omp_declare_target_var_p,
omp_discover_declare_target_fn_r, omp_discover_declare_target_var_r,
omp_discover_implicit_declare_target): New functions.
* cgraphunit.c (analyze_functions): Call
omp_discover_implicit_declare_target.
* testsuite/libgomp.c/target-39.c: New test.
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/ChangeLog | 4 | ||||
-rw-r--r-- | libgomp/testsuite/libgomp.c/target-39.c | 47 |
2 files changed, 51 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index b6828ad..1265640 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2020-05-12 Jakub Jelinek <jakub@redhat.com> + + * testsuite/libgomp.c/target-39.c: New test. + 2020-04-29 Thomas Schwinge <thomas@codesourcery.com> * config/accel/openacc.f90 (acc_device_current): Set to '-1'. diff --git a/libgomp/testsuite/libgomp.c/target-39.c b/libgomp/testsuite/libgomp.c/target-39.c new file mode 100644 index 0000000..4442f43 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/target-39.c @@ -0,0 +1,47 @@ +/* { dg-do run } */ +/* { dg-options "-O0" } */ + +extern void abort (void); +volatile int v; +#pragma omp declare target to (v) +typedef void (*fnp1) (void); +typedef fnp1 (*fnp2) (void); +void f1 (void) { v++; } +void f2 (void) { v += 4; } +void f3 (void) { v += 16; f1 (); } +fnp1 f4 (void) { v += 64; return f2; } +int a = 1; +int *b = &a; +int **c = &b; +fnp2 f5 (void) { f3 (); return f4; } +#pragma omp declare target to (c, f5) + +int +main () +{ + int err = 0; + #pragma omp target map(from:err) + { + volatile int xa; + int *volatile xb; + int **volatile xc; + fnp2 xd; + fnp1 xe; + err = 0; + xa = a; + err |= xa != 1; + xb = b; + err |= xb != &a; + xc = c; + err |= xc != &b; + xd = f5 (); + err |= v != 17; + xe = xd (); + err |= v != 81; + xe (); + err |= v != 85; + } + if (err) + abort (); + return 0; +} |