Hi!

On Wed, 19 Dec 2018 15:28:41 +0100, Tom de Vries <tdevr...@suse.de> wrote:
> The goacc.exp test-cases nvptx-merged-loop.c and nvptx-sese-1.c are failing
> during linking due to missing libgomp.spec.

Right; see also
<http://mid.mail-archive.com/87bnalrwdl.fsf@kepler.schwinge.homeip.net>,
from three years ago.  ;-)

> Move them to the libgomp testsuite.
> 
> Build and reg-tested on x86_64 with nvptx accelerator.
> 
> Committed to trunk.

ACK, thanks.

> diff --git a/gcc/testsuite/gcc.dg/goacc/nvptx-merged-loop.c 
> b/libgomp/testsuite/libgomp.oacc-c-c++-common/nvptx-merged-loop.c
> similarity index 59%
> rename from gcc/testsuite/gcc.dg/goacc/nvptx-merged-loop.c
> rename to libgomp/testsuite/libgomp.oacc-c-c++-common/nvptx-merged-loop.c
> index 3ff537c1d97..8a2117e1624 100644
> --- a/gcc/testsuite/gcc.dg/goacc/nvptx-merged-loop.c
> +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/nvptx-merged-loop.c
> @@ -1,6 +1,6 @@
> -/* { dg-do link } */
> -/* { dg-require-effective-target offload_nvptx } */
> -/* { dg-options "-fopenacc -O2 -foffload=-fdump-rtl-mach\\ -dumpbase\\ 
> nvptx-merged-loop.c\\ -Wa,--no-verify" } */
> +/* { dg-do run { target openacc_nvidia_accel_selected } } */
> +/* { dg-options "-foffload=-fdump-rtl-mach" } */
> +/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
> [...]
> -/* { dg-final { scan-rtl-dump "Merging loop .* into " "mach" } } */
> +/* { dg-final { scan-offload-rtl-dump "Merging loop .* into " "mach" } } */

There is however still a problem here: if you have more than one offload
compiler configured, all of them will react to
'-foffload=-fdump-rtl-mach', and will overwrite their dump files, or if
different compiler passes configured, that may produce more than one
"mach" dump file, all this resulting in "funny" testing FAILs/ERRORs.
But: we can't just use '-foffload=[nvptx]=-fdump-rtl-mach', because
'[nvptx]' can be 'nvptx', or 'nvptx-none', etc.

Similar problem for a lot of other test cases that you've recently added
(... but thanks for all these, of course!).

And, "dg-require-effective-target offload_nvptx" is now obsolete, and
should be removed.

All this I'm addressing in the commits I've just done, see attached:

  - r269106 "[libgomp] In OpenACC offloading testing, be more explicit in
    what is supported, and what is not, or why not"
  - r269107 "[libgomp] Clarify difference between offload target, offload
    plugin, and OpenACC device type"
  - r269108 "[libgomp] In OpenACC testing, cycle though all offload
    targets"
  - r269109 "[libgomp] In OpenACC testing, by default only build for the
    offload target that we're actually going to test"
  - r269110 "Remove unused check_effective_target_offload_nvptx"

These libgomp changes improves testing time, as discussed before, and
clean up the test log as follows:

    UNSUPPORTED: 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0 
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    [-ERROR:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-merged-loop.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
[-: error executing dg-final: couldn't open "nvptx-merged-loop.o.304r.mach 
nvptx-merged-loop.o.307r.mach": no such file or 
directory-]{+scan-offload-rtl-dump mach "Merging loop .* into "+}

    UNSUPPORTED: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-sese-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0 
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-sese-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-sese-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    [-ERROR:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/nvptx-sese-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
[-: error executing dg-final: couldn't open "nvptx-sese-1.o.307r.mach 
nvptx-sese-1.o.304r.mach": no such file or directory-]{+scan-offload-rtl-dump 
mach "SESE regions:.* [0-9]+{[0-9]+->[0-9]+(\\.[0-9]+)+}"+}

    UNSUPPORTED: libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr85381-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0 
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr85381-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr85381-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    [-FAIL:-]{+PASS:+} libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr85381-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-assembler-times bar.sync 2

    UNSUPPORTED: libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr85381-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0 
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr85381-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr85381-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    [-FAIL:-]{+PASS:+} libgomp.oacc-c/../libgomp.oacc-c-c++-common/pr85381-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-assembler-times bar.sync 4

    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 1, 
128\\)"
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-1.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 1, 
128\\)"

    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 1, 
128\\)"
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-2.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 1, 
128\\)"

    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-3.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-3.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-3.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-3.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 1, 
32\\)"
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-3.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-3.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-3.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-3.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 1, 
32\\)"

    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 2, 
128\\)"
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-4.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 2, 
128\\)"

    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-5.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-5.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-5.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-5.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 2, 
128\\)"
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-5.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-5.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-5.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-5.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 2, 
128\\)"

    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-6.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-6.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-6.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-6.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 0, 
128\\)"
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-6.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-6.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-6.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-6.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 0, 
128\\)"

    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O0   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 0, 
128\\)"
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
(test for excess errors)
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
execution test
    PASS: libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2  
output pattern test
    [-FAIL:-]{+PASS:+} 
libgomp.oacc-c/../libgomp.oacc-c-c++-common/vector-length-128-7.c 
-DACC_DEVICE_TYPE_nvidia=1 -DACC_MEM_SHARED=0 {+-foffload=nvptx-none+}  -O2   
scan-offload-tree-dump oaccdevlow "__attribute__\\(\\(oacc function \\(1, 0, 
128\\)"

Same for 'libgomp.oacc-c++'.


Grüße
 Thomas


From e03c3144d02850737551a071b6525f13efcde7c0 Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 22 Feb 2019 10:50:49 +0000
Subject: [PATCH 5/9] [libgomp] In OpenACC offloading testing, be more explicit
 in what is supported, and what is not, or why not

	libgomp/
	* testsuite/lib/libgomp.exp: Error out for unknown offload target.
	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.  Report if
	"offloading: supported, but hardware not accessible".
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269106 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                                  | 8 ++++++++
 libgomp/testsuite/lib/libgomp.exp                  | 7 +++++--
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 4 ++--
 libgomp/testsuite/libgomp.oacc-c/c.exp             | 4 ++--
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp | 4 ++--
 5 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index f310c2f6c24..32bc21f50fd 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,11 @@
+2019-02-22  Thomas Schwinge  <tho...@codesourcery.com>
+
+	* testsuite/lib/libgomp.exp: Error out for unknown offload target.
+	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.  Report if
+	"offloading: supported, but hardware not accessible".
+	* testsuite/libgomp.oacc-c/c.exp: Likewise.
+	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+
 2019-02-19  Chung-Lin Tang <clt...@codesourcery.com>
 
 	PR c/87924
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 04738a9ce82..2392642c7d6 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -58,6 +58,9 @@ foreach offload_target_openacc $offload_targets_s {
 	hsa {
 	    continue
 	}
+	default {
+	    error "Unknown offload target: $offload_target_openacc"
+	}
     }
     lappend offload_targets_s_openacc "$offload_target_openacc"
 }
@@ -375,7 +378,7 @@ proc check_effective_target_openacc_nvidia_accel_configured { } {
     return [is-effective-target lp64]
 }
 
-# Return 1 if at least one nvidia board is present.
+# Return 1 if at least one Nvidia GPU is accessible.
 
 proc check_effective_target_openacc_nvidia_accel_present { } {
     return [check_runtime openacc_nvidia_accel_present {
@@ -386,7 +389,7 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
     } "" ]
 }
 
-# Return 1 if at least one nvidia board is present, and the nvidia device type
+# Return 1 if at least one Nvidia GPU is accessible, and the nvidia device type
 # is selected by default by means of setting the environment variable
 # ACC_DEVICE_TYPE.
 
diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 9beadd6fc1e..d0e5f42b88b 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -88,7 +88,7 @@ if { $lang_test_file_found } {
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $offload_target_openacc offloading"
+		    untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible"
 		    continue
 		}
 
@@ -101,7 +101,7 @@ if { $lang_test_file_found } {
 		set acc_mem_shared 0
 	    }
 	    default {
-		set acc_mem_shared 0
+		error "Unknown OpenACC device type: $offload_target_openacc"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp
index 4475bf5341f..77e852efaef 100644
--- a/libgomp/testsuite/libgomp.oacc-c/c.exp
+++ b/libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -51,7 +51,7 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 	nvidia {
 	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		# Don't bother; execution testing is going to FAIL.
-		untested "$subdir $offload_target_openacc offloading"
+		untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible"
 		continue
 	    }
 
@@ -64,7 +64,7 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 	    set acc_mem_shared 0
 	}
 	default {
-	    set acc_mem_shared 0
+	    error "Unknown OpenACC device type: $offload_target_openacc"
 	}
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index 663c9323b72..a262a8a2c97 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -76,14 +76,14 @@ if { $lang_test_file_found } {
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $offload_target_openacc offloading"
+		    untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible"
 		    continue
 		}
 
 		set acc_mem_shared 0
 	    }
 	    default {
-		set acc_mem_shared 0
+		error "Unknown OpenACC device type: $offload_target_openacc"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
-- 
2.17.1

From 3a590203770f56ae3ced3d81c59483caeda037cd Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 22 Feb 2019 10:51:05 +0000
Subject: [PATCH 6/9] [libgomp] Clarify difference between offload target,
 offload plugin, and OpenACC device type

	libgomp/
	* plugin/configfrag.ac: Populate and AC_SUBST offload_plugins
	instead of offload_targets, and AC_DEFINE_UNQUOTED OFFLOAD_PLUGINS
	instead of OFFLOAD_TARGETS.
	* target.c (gomp_target_init): Adjust.
	* testsuite/libgomp-test-support.exp.in: Likewise.
	* testsuite/lib/libgomp.exp: Likewise.  Populate
	openacc_device_types_s instead of offload_targets_s_openacc.
	(check_effective_target_openacc_nvidia_accel_selected)
	(check_effective_target_openacc_host_selected): Adjust.
	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* Makefile.in: Regenerate.
	* config.h.in: Likewise.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269107 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                             | 17 ++++++
 libgomp/Makefile.in                           |  2 +-
 libgomp/config.h.in                           |  4 +-
 libgomp/configure                             | 36 ++++++------
 libgomp/plugin/configfrag.ac                  | 36 ++++++------
 libgomp/target.c                              |  8 +--
 libgomp/testsuite/Makefile.in                 |  2 +-
 libgomp/testsuite/lib/libgomp.exp             | 56 ++++++++-----------
 libgomp/testsuite/libgomp-test-support.exp.in |  2 +-
 libgomp/testsuite/libgomp.oacc-c++/c++.exp    | 17 +++---
 libgomp/testsuite/libgomp.oacc-c/c.exp        | 17 +++---
 .../libgomp.oacc-fortran/fortran.exp          | 15 ++---
 12 files changed, 114 insertions(+), 98 deletions(-)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 32bc21f50fd..344e83f082f 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,22 @@
 2019-02-22  Thomas Schwinge  <tho...@codesourcery.com>
 
+	* plugin/configfrag.ac: Populate and AC_SUBST offload_plugins
+	instead of offload_targets, and AC_DEFINE_UNQUOTED OFFLOAD_PLUGINS
+	instead of OFFLOAD_TARGETS.
+	* target.c (gomp_target_init): Adjust.
+	* testsuite/libgomp-test-support.exp.in: Likewise.
+	* testsuite/lib/libgomp.exp: Likewise.  Populate
+	openacc_device_types_s instead of offload_targets_s_openacc.
+	(check_effective_target_openacc_nvidia_accel_selected)
+	(check_effective_target_openacc_host_selected): Adjust.
+	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.
+	* testsuite/libgomp.oacc-c/c.exp: Likewise.
+	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+	* Makefile.in: Regenerate.
+	* config.h.in: Likewise.
+	* configure: Likewise.
+	* testsuite/Makefile.in: Likewise.
+
 	* testsuite/lib/libgomp.exp: Error out for unknown offload target.
 	* testsuite/libgomp.oacc-c++/c++.exp: Likewise.  Report if
 	"offloading: supported, but hardware not accessible".
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 325629cb0aa..12ce8d05c19 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -493,7 +493,7 @@ mkdir_p = @mkdir_p@
 multi_basedir = @multi_basedir@
 offload_additional_lib_paths = @offload_additional_lib_paths@
 offload_additional_options = @offload_additional_options@
-offload_targets = @offload_targets@
+offload_plugins = @offload_plugins@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
diff --git a/libgomp/config.h.in b/libgomp/config.h.in
index 52f4ed44412..73f1b12805e 100644
--- a/libgomp/config.h.in
+++ b/libgomp/config.h.in
@@ -146,8 +146,8 @@
    */
 #undef LT_OBJDIR
 
-/* Define to offload targets, separated by commas. */
-#undef OFFLOAD_TARGETS
+/* Define to offload plugins, separated by commas. */
+#undef OFFLOAD_PLUGINS
 
 /* Name of package */
 #undef PACKAGE
diff --git a/libgomp/configure b/libgomp/configure
index 013e37c0ba5..1033ae4d988 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -667,6 +667,7 @@ PLUGIN_NVPTX_FALSE
 PLUGIN_NVPTX_TRUE
 offload_additional_lib_paths
 offload_additional_options
+offload_plugins
 PLUGIN_HSA_LIBS
 PLUGIN_HSA_LDFLAGS
 PLUGIN_HSA_CPPFLAGS
@@ -679,7 +680,6 @@ PLUGIN_NVPTX_CPPFLAGS
 PLUGIN_NVPTX
 CUDA_DRIVER_LIB
 CUDA_DRIVER_INCLUDE
-offload_targets
 libtool_VERSION
 ac_ct_FC
 FCFLAGS
@@ -15401,8 +15401,6 @@ fi
 # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-offload_targets=
-
 plugin_support=yes
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
 $as_echo_n "checking for dlsym in -ldl... " >&6; }
@@ -15621,7 +15619,10 @@ PLUGIN_HSA_LIBS=
 
 
 
-# Get offload targets and path to install tree of offloading compiler.
+# Parse '--enable-offload-targets', figure out the corresponding libgomp
+# plugins, and configure to find the corresponding offload compilers.
+offload_plugins=
+
 offload_additional_options=
 offload_additional_lib_paths=
 
@@ -15630,13 +15631,13 @@ if test x"$enable_offload_targets" != x; then
   for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
     tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
     tgt=`echo $tgt | sed 's/=.*//'`
-    tgt_name=
+    tgt_plugin=
     case $tgt in
       *-intelmic-* | *-intelmicemul-*)
-	tgt_name=intelmic
+	tgt_plugin=intelmic
 	;;
       nvptx*)
-        tgt_name=nvptx
+	tgt_plugin=nvptx
 	PLUGIN_NVPTX=$tgt
 	if test "x$CUDA_DRIVER_LIB" != xno \
 	   && test "x$CUDA_DRIVER_LIB" != xno; then
@@ -15695,7 +15696,7 @@ rm -f core conftest.err conftest.$ac_objext \
 	        PLUGIN_HSA=0
 		;;
 	      *)
-	        tgt_name=hsa
+		tgt_plugin=hsa
 	        PLUGIN_HSA=$tgt
 	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
 	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS"
@@ -15713,7 +15714,7 @@ rm -f core conftest.err conftest.$ac_objext \
 	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
 	        LIBS=$PLUGIN_HSA_save_LIBS
 	        case $PLUGIN_HSA in
-	          hsa*)
+		  hsa*)
 	            HSA_PLUGIN=0
 	            as_fn_error $? "HSA run-time package required for HSA support" "$LINENO" 5
 	            ;;
@@ -15730,16 +15731,17 @@ rm -f core conftest.err conftest.$ac_objext \
 	as_fn_error $? "unknown offload target specified" "$LINENO" 5
 	;;
     esac
-    if test x"$tgt_name" = x; then
-      # Don't configure libgomp for this offloading target if we don't build
-      # the corresponding plugin.
+    if test x"$tgt_plugin" = x; then
+      # Not configuring libgomp for this offload target if we're not building
+      # the corresponding offload plugin.
       continue
-    elif test x"$offload_targets" = x; then
-      offload_targets=$tgt_name
+    elif test x"$offload_plugins" = x; then
+      offload_plugins=$tgt_plugin
     else
-      offload_targets=$offload_targets,$tgt_name
+      offload_plugins=$offload_plugins,$tgt_plugin
     fi
-    if test "$tgt_name" = hsa; then
+    # Configure additional search paths.
+    if test "$tgt_plugin" = hsa; then
       # Offloading compilation is all handled by the target compiler.
       :
     elif test x"$tgt_dir" != x; then
@@ -15753,7 +15755,7 @@ rm -f core conftest.err conftest.$ac_objext \
 fi
 
 cat >>confdefs.h <<_ACEOF
-#define OFFLOAD_TARGETS "$offload_targets"
+#define OFFLOAD_PLUGINS "$offload_plugins"
 _ACEOF
 
  if test $PLUGIN_NVPTX = 1; then
diff --git a/libgomp/plugin/configfrag.ac b/libgomp/plugin/configfrag.ac
index 2cd59cd974e..c49d17991e6 100644
--- a/libgomp/plugin/configfrag.ac
+++ b/libgomp/plugin/configfrag.ac
@@ -26,8 +26,6 @@
 # see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-offload_targets=
-AC_SUBST(offload_targets)
 plugin_support=yes
 AC_CHECK_LIB(dl, dlsym, , [plugin_support=no])
 if test x"$plugin_support" = xyes; then
@@ -139,7 +137,10 @@ AC_SUBST(PLUGIN_HSA_CPPFLAGS)
 AC_SUBST(PLUGIN_HSA_LDFLAGS)
 AC_SUBST(PLUGIN_HSA_LIBS)
 
-# Get offload targets and path to install tree of offloading compiler.
+# Parse '--enable-offload-targets', figure out the corresponding libgomp
+# plugins, and configure to find the corresponding offload compilers.
+offload_plugins=
+AC_SUBST(offload_plugins)
 offload_additional_options=
 offload_additional_lib_paths=
 AC_SUBST(offload_additional_options)
@@ -148,13 +149,13 @@ if test x"$enable_offload_targets" != x; then
   for tgt in `echo $enable_offload_targets | sed -e 's#,# #g'`; do
     tgt_dir=`echo $tgt | grep '=' | sed 's/.*=//'`
     tgt=`echo $tgt | sed 's/=.*//'`
-    tgt_name=
+    tgt_plugin=
     case $tgt in
       *-intelmic-* | *-intelmicemul-*)
-	tgt_name=intelmic
+	tgt_plugin=intelmic
 	;;
       nvptx*)
-        tgt_name=nvptx
+	tgt_plugin=nvptx
 	PLUGIN_NVPTX=$tgt
 	if test "x$CUDA_DRIVER_LIB" != xno \
 	   && test "x$CUDA_DRIVER_LIB" != xno; then
@@ -202,7 +203,7 @@ if test x"$enable_offload_targets" != x; then
 	        PLUGIN_HSA=0
 		;;
 	      *)
-	        tgt_name=hsa
+		tgt_plugin=hsa
 	        PLUGIN_HSA=$tgt
 	        PLUGIN_HSA_CPPFLAGS=$HSA_RUNTIME_CPPFLAGS
 	        PLUGIN_HSA_LDFLAGS="$HSA_RUNTIME_LDFLAGS"
@@ -220,7 +221,7 @@ if test x"$enable_offload_targets" != x; then
 	        LDFLAGS=$PLUGIN_HSA_save_LDFLAGS
 	        LIBS=$PLUGIN_HSA_save_LIBS
 	        case $PLUGIN_HSA in
-	          hsa*)
+		  hsa*)
 	            HSA_PLUGIN=0
 	            AC_MSG_ERROR([HSA run-time package required for HSA support])
 	            ;;
@@ -237,16 +238,17 @@ if test x"$enable_offload_targets" != x; then
 	AC_MSG_ERROR([unknown offload target specified])
 	;;
     esac
-    if test x"$tgt_name" = x; then
-      # Don't configure libgomp for this offloading target if we don't build
-      # the corresponding plugin.
+    if test x"$tgt_plugin" = x; then
+      # Not configuring libgomp for this offload target if we're not building
+      # the corresponding offload plugin.
       continue
-    elif test x"$offload_targets" = x; then
-      offload_targets=$tgt_name
+    elif test x"$offload_plugins" = x; then
+      offload_plugins=$tgt_plugin
     else
-      offload_targets=$offload_targets,$tgt_name
+      offload_plugins=$offload_plugins,$tgt_plugin
     fi
-    if test "$tgt_name" = hsa; then
+    # Configure additional search paths.
+    if test "$tgt_plugin" = hsa; then
       # Offloading compilation is all handled by the target compiler.
       :
     elif test x"$tgt_dir" != x; then
@@ -258,8 +260,8 @@ if test x"$enable_offload_targets" != x; then
     fi
   done
 fi
-AC_DEFINE_UNQUOTED(OFFLOAD_TARGETS, "$offload_targets",
-  [Define to offload targets, separated by commas.])
+AC_DEFINE_UNQUOTED(OFFLOAD_PLUGINS, "$offload_plugins",
+  [Define to offload plugins, separated by commas.])
 AM_CONDITIONAL([PLUGIN_NVPTX], [test $PLUGIN_NVPTX = 1])
 AC_DEFINE_UNQUOTED([PLUGIN_NVPTX], [$PLUGIN_NVPTX],
   [Define to 1 if the NVIDIA plugin is built, 0 if not.])
diff --git a/libgomp/target.c b/libgomp/target.c
index 8af5f97c38b..31148003d0a 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -2710,9 +2710,9 @@ gomp_target_fini (void)
     }
 }
 
-/* This function initializes the runtime needed for offloading.
-   It parses the list of offload targets and tries to load the plugins for
-   these targets.  On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
+/* This function initializes the runtime for offloading.
+   It parses the list of offload plugins, and tries to load these.
+   On return, the variables NUM_DEVICES and NUM_DEVICES_OPENMP
    will be set, and the array DEVICES initialized, containing descriptors for
    corresponding devices, first the GOMP_OFFLOAD_CAP_OPENMP_400 ones, follows
    by the others.  */
@@ -2729,7 +2729,7 @@ gomp_target_init (void)
   num_devices = 0;
   devices = NULL;
 
-  cur = OFFLOAD_TARGETS;
+  cur = OFFLOAD_PLUGINS;
   if (*cur)
     do
       {
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index de91a958bcb..7e0e830b240 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -271,7 +271,7 @@ mkdir_p = @mkdir_p@
 multi_basedir = @multi_basedir@
 offload_additional_lib_paths = @offload_additional_lib_paths@
 offload_additional_options = @offload_additional_options@
-offload_targets = @offload_targets@
+offload_plugins = @offload_plugins@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 2392642c7d6..766e9ddd95b 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -41,19 +41,19 @@ load_gcc_lib fortran-modules.exp
 # Try to load a test support file, built during libgomp configuration.
 load_file libgomp-test-support.exp
 
-# Populate offload_targets_s (offloading targets separated by a space), and
-# offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
-# some of them a little differently).
-set offload_targets_s [split $offload_targets ","]
-set offload_targets_s_openacc {}
-foreach offload_target_openacc $offload_targets_s {
+# Populate offload_plugins_s (offload plugins, separated by a space), and
+# openacc_device_types_s (OpenACC device type names for suitable offload
+# plugins, separated by a space).
+set offload_plugins_s [split $offload_plugins ","]
+set openacc_device_types_s {}
+foreach offload_plugin $offload_plugins_s {
     # Translate to OpenACC names, or skip if not yet supported.
-    switch $offload_target_openacc {
+    switch $offload_plugin {
 	intelmic {
 	    continue
 	}
 	nvptx {
-	    set offload_target_openacc "nvidia"
+	    set offload_plugin "nvidia"
 	}
 	hsa {
 	    continue
@@ -62,9 +62,9 @@ foreach offload_target_openacc $offload_targets_s {
 	    error "Unknown offload target: $offload_target_openacc"
 	}
     }
-    lappend offload_targets_s_openacc "$offload_target_openacc"
+    lappend openacc_device_types_s "$offload_plugin"
 }
-lappend offload_targets_s_openacc "host"
+lappend openacc_device_types_s "host"
 
 set dg-do-what-default run
 
@@ -143,9 +143,9 @@ proc libgomp_init { args } {
     set always_ld_library_path ".:${blddir}/.libs"
 
     # Add liboffloadmic build directory in LD_LIBRARY_PATH to support
-    # non-fallback testing for Intel MIC targets
-    global offload_targets
-    if { [string match "*,intelmic,*" ",$offload_targets,"] } {
+    # Intel MIC offloading testing.
+    global offload_plugins
+    if { [string match "*,intelmic,*" ",$offload_plugins,"] } {
 	append always_ld_library_path ":${blddir}/../liboffloadmic/.libs"
 	append always_ld_library_path ":${blddir}/../liboffloadmic/plugin/.libs"
 	# libstdc++ is required by liboffloadmic
@@ -249,8 +249,7 @@ proc libgomp_init { args } {
     # Disable color diagnostics
     lappend ALWAYS_CFLAGS "additional_flags=-fdiagnostics-color=never"
 
-    # Used for support non-fallback offloading.
-    # Help GCC to find target mkoffload.
+    # Help GCC to find offload compilers' 'mkoffload'.
     global offload_additional_options
     if { $offload_additional_options != "" } {
 	lappend ALWAYS_CFLAGS "additional_flags=${offload_additional_options}"
@@ -366,11 +365,11 @@ proc check_effective_target_offload_device_shared_as { } {
     } ]
 }
 
-# Return 1 if configured for nvptx offloading.
+# Return 1 if configured for 'nvptx' offloading.
 
 proc check_effective_target_openacc_nvidia_accel_configured { } {
-    global offload_targets
-    if { ![string match "*,nvptx,*" ",$offload_targets,"] } {
+    global offload_plugins
+    if { ![string match "*,nvptx,*" ",$offload_plugins,"] } {
         return 0
     }
     # PR libgomp/65099: Currently, we only support offloading in 64-bit
@@ -389,29 +388,22 @@ proc check_effective_target_openacc_nvidia_accel_present { } {
     } "" ]
 }
 
-# Return 1 if at least one Nvidia GPU is accessible, and the nvidia device type
-# is selected by default by means of setting the environment variable
-# ACC_DEVICE_TYPE.
+# Return 1 if at least one Nvidia GPU is accessible, and the OpenACC 'nvidia'
+# device type is selected.
 
 proc check_effective_target_openacc_nvidia_accel_selected { } {
     if { ![check_effective_target_openacc_nvidia_accel_present] } {
 	return 0;
     }
-    global offload_target_openacc
-    if { $offload_target_openacc == "nvidia" } {
-        return 1;
-    }
-    return 0;
+    global openacc_device_type
+    return [string match "nvidia" $openacc_device_type]
 }
 
-# Return 1 if the host target is selected for offloaded
+# Return 1 if the OpenACC 'host' device type is selected.
 
 proc check_effective_target_openacc_host_selected { } {
-    global offload_target_openacc
-    if { $offload_target_openacc == "host" } {
-        return 1;
-    }
-    return 0;
+    global openacc_device_type
+    return [string match "host" $openacc_device_type]
 }
 
 # Return 1 if the selected OMP device is actually a HSA device
diff --git a/libgomp/testsuite/libgomp-test-support.exp.in b/libgomp/testsuite/libgomp-test-support.exp.in
index a5250a802c4..6cf31ae4bf9 100644
--- a/libgomp/testsuite/libgomp-test-support.exp.in
+++ b/libgomp/testsuite/libgomp-test-support.exp.in
@@ -2,4 +2,4 @@ set cuda_driver_include "@CUDA_DRIVER_INCLUDE@"
 set cuda_driver_lib "@CUDA_DRIVER_LIB@"
 set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
 
-set offload_targets "@offload_targets@"
+set offload_plugins "@offload_plugins@"
diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
index d0e5f42b88b..0854f60c8fa 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -77,18 +77,19 @@ if { $lang_test_file_found } {
 	set libstdcxx_includes ""
     }
 
-    # Test OpenACC with available accelerators.
-    foreach offload_target_openacc $offload_targets_s_openacc {
-	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    # Test with available OpenACC device types.
+    global openacc_device_type
+    foreach openacc_device_type $openacc_device_types_s {
+	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-	switch $offload_target_openacc {
+	switch $openacc_device_type {
 	    host {
 		set acc_mem_shared 1
 	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible"
+		    untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
 		    continue
 		}
 
@@ -101,12 +102,12 @@ if { $lang_test_file_found } {
 		set acc_mem_shared 0
 	    }
 	    default {
-		error "Unknown OpenACC device type: $offload_target_openacc"
+		error "Unknown OpenACC device type: $openacc_device_type"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-	setenv ACC_DEVICE_TYPE $offload_target_openacc
+	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# To get better test coverage for device-specific code that is only
 	# ever used in offloading configurations, we'd like more thorough
@@ -115,7 +116,7 @@ if { $lang_test_file_found } {
 	# -O0 and -O2 only, to avoid testing times exploding too much, under
 	# the assumption that between -O0 and -O[something] there is the
 	# biggest difference in the overall structure of the generated code.
-	switch $offload_target_openacc {
+	switch $openacc_device_type {
 	    host {
 		set-torture-options [list \
 					 { -O2 } ]
diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp
index 77e852efaef..2e0c050d6de 100644
--- a/libgomp/testsuite/libgomp.oacc-c/c.exp
+++ b/libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -38,20 +38,21 @@ set ld_library_path $always_ld_library_path
 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
 set_ld_library_path_env_vars
 
-# Test OpenACC with available accelerators.
+# Test with available OpenACC device types.
 set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
-foreach offload_target_openacc $offload_targets_s_openacc {
+global openacc_device_type
+foreach openacc_device_type $openacc_device_types_s {
     set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
-    set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-    switch $offload_target_openacc {
+    switch $openacc_device_type {
 	host {
 	    set acc_mem_shared 1
 	}
 	nvidia {
 	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		# Don't bother; execution testing is going to FAIL.
-		untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible"
+		untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
 		continue
 	    }
 
@@ -64,12 +65,12 @@ foreach offload_target_openacc $offload_targets_s_openacc {
 	    set acc_mem_shared 0
 	}
 	default {
-	    error "Unknown OpenACC device type: $offload_target_openacc"
+	    error "Unknown OpenACC device type: $openacc_device_type"
 	}
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-    setenv ACC_DEVICE_TYPE $offload_target_openacc
+    setenv ACC_DEVICE_TYPE $openacc_device_type
 
     # To get better test coverage for device-specific code that is only
     # ever used in offloading configurations, we'd like more thorough
@@ -78,7 +79,7 @@ foreach offload_target_openacc $offload_targets_s_openacc {
     # -O0 and -O2 only, to avoid testing times exploding too much, under
     # the assumption that between -O0 and -O[something] there is the
     # biggest difference in the overall structure of the generated code.
-    switch $offload_target_openacc {
+    switch $openacc_device_type {
 	host {
 	    set-torture-options [list \
 				     { -O2 } ]
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index a262a8a2c97..83f4f6b47d8 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -65,30 +65,31 @@ if { $lang_test_file_found } {
     append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
-    # Test OpenACC with available accelerators.
-    foreach offload_target_openacc $offload_targets_s_openacc {
-	set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
+    # Test with available OpenACC device types.
+    global openacc_device_type
+    foreach openacc_device_type $openacc_device_types_s {
+	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
-	switch $offload_target_openacc {
+	switch $openacc_device_type {
 	    host {
 		set acc_mem_shared 1
 	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $offload_target_openacc offloading: supported, but hardware not accessible"
+		    untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
 		    continue
 		}
 
 		set acc_mem_shared 0
 	    }
 	    default {
-		error "Unknown OpenACC device type: $offload_target_openacc"
+		error "Unknown OpenACC device type: $openacc_device_type"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
-	setenv ACC_DEVICE_TYPE $offload_target_openacc
+	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# For Fortran we're doing torture testing, as Fortran has far more tests
 	# with arrays etc. that testing just -O0 or -O2 is insufficient, that is
-- 
2.17.1

From 62f346033638e494355ff54cdd795b606780a71c Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 22 Feb 2019 10:51:20 +0000
Subject: [PATCH 7/9] [libgomp] In OpenACC testing, cycle though all offload
 targets

... instead of through offload plugins.

	libgomp/
	* plugin/configfrag.ac: Populate and AC_SUBST offload_targets.
	* testsuite/libgomp-test-support.exp.in: Adjust.
	* testsuite/lib/libgomp.exp: Likewise.  Don't populate
	openacc_device_types_s.
	(offload_target_to_openacc_device_type): New proc.
	* testsuite/libgomp.oacc-c++/c++.exp: Adjust.
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* Makefile.in: Regenerate.
	* configure: Likewise.
	* testsuite/Makefile.in: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269108 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                             | 12 +++++
 libgomp/Makefile.in                           |  1 +
 libgomp/configure                             | 10 +++-
 libgomp/plugin/configfrag.ac                  |  5 ++
 libgomp/testsuite/Makefile.in                 |  1 +
 libgomp/testsuite/lib/libgomp.exp             | 51 +++++++++----------
 libgomp/testsuite/libgomp-test-support.exp.in |  1 +
 libgomp/testsuite/libgomp.oacc-c++/c++.exp    | 19 ++++---
 libgomp/testsuite/libgomp.oacc-c/c.exp        | 19 ++++---
 .../libgomp.oacc-fortran/fortran.exp          | 15 ++++--
 10 files changed, 86 insertions(+), 48 deletions(-)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 344e83f082f..53a5511b033 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,17 @@
 2019-02-22  Thomas Schwinge  <tho...@codesourcery.com>
 
+	* plugin/configfrag.ac: Populate and AC_SUBST offload_targets.
+	* testsuite/libgomp-test-support.exp.in: Adjust.
+	* testsuite/lib/libgomp.exp: Likewise.  Don't populate
+	openacc_device_types_s.
+	(offload_target_to_openacc_device_type): New proc.
+	* testsuite/libgomp.oacc-c++/c++.exp: Adjust.
+	* testsuite/libgomp.oacc-c/c.exp: Likewise.
+	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+	* Makefile.in: Regenerate.
+	* configure: Likewise.
+	* testsuite/Makefile.in: Likewise.
+
 	* plugin/configfrag.ac: Populate and AC_SUBST offload_plugins
 	instead of offload_targets, and AC_DEFINE_UNQUOTED OFFLOAD_PLUGINS
 	instead of OFFLOAD_TARGETS.
diff --git a/libgomp/Makefile.in b/libgomp/Makefile.in
index 12ce8d05c19..c7e63f120fd 100644
--- a/libgomp/Makefile.in
+++ b/libgomp/Makefile.in
@@ -494,6 +494,7 @@ multi_basedir = @multi_basedir@
 offload_additional_lib_paths = @offload_additional_lib_paths@
 offload_additional_options = @offload_additional_options@
 offload_plugins = @offload_plugins@
+offload_targets = @offload_targets@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
diff --git a/libgomp/configure b/libgomp/configure
index 1033ae4d988..b4bc4f43628 100755
--- a/libgomp/configure
+++ b/libgomp/configure
@@ -667,6 +667,7 @@ PLUGIN_NVPTX_FALSE
 PLUGIN_NVPTX_TRUE
 offload_additional_lib_paths
 offload_additional_options
+offload_targets
 offload_plugins
 PLUGIN_HSA_LIBS
 PLUGIN_HSA_LDFLAGS
@@ -11392,7 +11393,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11395 "configure"
+#line 11396 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11498,7 +11499,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11501 "configure"
+#line 11502 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15621,7 +15622,10 @@ PLUGIN_HSA_LIBS=
 
 # Parse '--enable-offload-targets', figure out the corresponding libgomp
 # plugins, and configure to find the corresponding offload compilers.
+# 'offload_plugins' and 'offload_targets' will be populated in the same order.
 offload_plugins=
+offload_targets=
+
 
 offload_additional_options=
 offload_additional_lib_paths=
@@ -15737,8 +15741,10 @@ rm -f core conftest.err conftest.$ac_objext \
       continue
     elif test x"$offload_plugins" = x; then
       offload_plugins=$tgt_plugin
+      offload_targets=$tgt
     else
       offload_plugins=$offload_plugins,$tgt_plugin
+      offload_targets=$offload_targets,$tgt
     fi
     # Configure additional search paths.
     if test "$tgt_plugin" = hsa; then
diff --git a/libgomp/plugin/configfrag.ac b/libgomp/plugin/configfrag.ac
index c49d17991e6..9718ac752e2 100644
--- a/libgomp/plugin/configfrag.ac
+++ b/libgomp/plugin/configfrag.ac
@@ -139,8 +139,11 @@ AC_SUBST(PLUGIN_HSA_LIBS)
 
 # Parse '--enable-offload-targets', figure out the corresponding libgomp
 # plugins, and configure to find the corresponding offload compilers.
+# 'offload_plugins' and 'offload_targets' will be populated in the same order.
 offload_plugins=
+offload_targets=
 AC_SUBST(offload_plugins)
+AC_SUBST(offload_targets)
 offload_additional_options=
 offload_additional_lib_paths=
 AC_SUBST(offload_additional_options)
@@ -244,8 +247,10 @@ if test x"$enable_offload_targets" != x; then
       continue
     elif test x"$offload_plugins" = x; then
       offload_plugins=$tgt_plugin
+      offload_targets=$tgt
     else
       offload_plugins=$offload_plugins,$tgt_plugin
+      offload_targets=$offload_targets,$tgt
     fi
     # Configure additional search paths.
     if test "$tgt_plugin" = hsa; then
diff --git a/libgomp/testsuite/Makefile.in b/libgomp/testsuite/Makefile.in
index 7e0e830b240..80315b15a7d 100644
--- a/libgomp/testsuite/Makefile.in
+++ b/libgomp/testsuite/Makefile.in
@@ -272,6 +272,7 @@ multi_basedir = @multi_basedir@
 offload_additional_lib_paths = @offload_additional_lib_paths@
 offload_additional_options = @offload_additional_options@
 offload_plugins = @offload_plugins@
+offload_targets = @offload_targets@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 766e9ddd95b..cb75e06c585 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -41,31 +41,6 @@ load_gcc_lib fortran-modules.exp
 # Try to load a test support file, built during libgomp configuration.
 load_file libgomp-test-support.exp
 
-# Populate offload_plugins_s (offload plugins, separated by a space), and
-# openacc_device_types_s (OpenACC device type names for suitable offload
-# plugins, separated by a space).
-set offload_plugins_s [split $offload_plugins ","]
-set openacc_device_types_s {}
-foreach offload_plugin $offload_plugins_s {
-    # Translate to OpenACC names, or skip if not yet supported.
-    switch $offload_plugin {
-	intelmic {
-	    continue
-	}
-	nvptx {
-	    set offload_plugin "nvidia"
-	}
-	hsa {
-	    continue
-	}
-	default {
-	    error "Unknown offload target: $offload_target_openacc"
-	}
-    }
-    lappend openacc_device_types_s "$offload_plugin"
-}
-lappend openacc_device_types_s "host"
-
 set dg-do-what-default run
 
 #
@@ -325,6 +300,28 @@ proc libgomp_option_proc { option } {
     }
 }
 
+# Translate offload target to OpenACC device type.  Return the empty string if
+# not supported, and 'host' for offload target 'disable'.
+proc offload_target_to_openacc_device_type { offload_target } {
+    switch -glob $offload_target {
+	disable {
+	    return "host"
+	}
+	hsa* {
+	    return ""
+	}
+	*-intelmic* {
+	    return ""
+	}
+	nvptx* {
+	    return "nvidia"
+	}
+	default {
+	    error "Unknown offload target: $offload_target"
+	}
+    }
+}
+
 # Return 1 if offload device is available.
 proc check_effective_target_offload_device { } {
     return [check_runtime_nocache offload_device_available_ {
@@ -368,8 +365,8 @@ proc check_effective_target_offload_device_shared_as { } {
 # Return 1 if configured for 'nvptx' offloading.
 
 proc check_effective_target_openacc_nvidia_accel_configured { } {
-    global offload_plugins
-    if { ![string match "*,nvptx,*" ",$offload_plugins,"] } {
+    global offload_targets
+    if { ![string match "*,nvptx*,*" ",$offload_targets,"] } {
         return 0
     }
     # PR libgomp/65099: Currently, we only support offloading in 64-bit
diff --git a/libgomp/testsuite/libgomp-test-support.exp.in b/libgomp/testsuite/libgomp-test-support.exp.in
index 6cf31ae4bf9..98fb442b537 100644
--- a/libgomp/testsuite/libgomp-test-support.exp.in
+++ b/libgomp/testsuite/libgomp-test-support.exp.in
@@ -3,3 +3,4 @@ set cuda_driver_lib "@CUDA_DRIVER_LIB@"
 set hsa_runtime_lib "@HSA_RUNTIME_LIB@"
 
 set offload_plugins "@offload_plugins@"
+set offload_targets "@offload_targets@"
diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 0854f60c8fa..29805c67bad 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -77,19 +77,24 @@ if { $lang_test_file_found } {
 	set libstdcxx_includes ""
     }
 
-    # Test with available OpenACC device types.
-    global openacc_device_type
-    foreach openacc_device_type $openacc_device_types_s {
+    # Test with all available offload targets, and with offloading disabled.
+    foreach offload_target [concat [split $offload_targets ","] "disable"] {
+	global openacc_device_type
+	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
 	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
 	switch $openacc_device_type {
+	    "" {
+		unsupported "$subdir $offload_target offloading"
+		continue
+	    }
 	    host {
 		set acc_mem_shared 1
 	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
+		    untested "$subdir $offload_target offloading: supported, but hardware not accessible"
 		    continue
 		}
 
@@ -102,7 +107,7 @@ if { $lang_test_file_found } {
 		set acc_mem_shared 0
 	    }
 	    default {
-		error "Unknown OpenACC device type: $openacc_device_type"
+		error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
@@ -116,8 +121,8 @@ if { $lang_test_file_found } {
 	# -O0 and -O2 only, to avoid testing times exploding too much, under
 	# the assumption that between -O0 and -O[something] there is the
 	# biggest difference in the overall structure of the generated code.
-	switch $openacc_device_type {
-	    host {
+	switch -glob $offload_target {
+	    disable {
 		set-torture-options [list \
 					 { -O2 } ]
 	    }
diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp
index 2e0c050d6de..2cd75be0cc7 100644
--- a/libgomp/testsuite/libgomp.oacc-c/c.exp
+++ b/libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -38,21 +38,26 @@ set ld_library_path $always_ld_library_path
 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
 set_ld_library_path_env_vars
 
-# Test with available OpenACC device types.
+# Test with all available offload targets, and with offloading disabled.
 set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
-global openacc_device_type
-foreach openacc_device_type $openacc_device_types_s {
+foreach offload_target [concat [split $offload_targets ","] "disable"] {
     set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
+    global openacc_device_type
+    set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
     set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
     switch $openacc_device_type {
+	"" {
+	    unsupported "$subdir $offload_target offloading"
+	    continue
+	}
 	host {
 	    set acc_mem_shared 1
 	}
 	nvidia {
 	    if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		# Don't bother; execution testing is going to FAIL.
-		untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
+		untested "$subdir $offload_target offloading: supported, but hardware not accessible"
 		continue
 	    }
 
@@ -65,7 +70,7 @@ foreach openacc_device_type $openacc_device_types_s {
 	    set acc_mem_shared 0
 	}
 	default {
-	    error "Unknown OpenACC device type: $openacc_device_type"
+	    error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	}
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
@@ -79,8 +84,8 @@ foreach openacc_device_type $openacc_device_types_s {
     # -O0 and -O2 only, to avoid testing times exploding too much, under
     # the assumption that between -O0 and -O[something] there is the
     # biggest difference in the overall structure of the generated code.
-    switch $openacc_device_type {
-	host {
+    switch -glob $offload_target {
+	disable {
 	    set-torture-options [list \
 				     { -O2 } ]
 	}
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index 83f4f6b47d8..b2baa73d91a 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -65,26 +65,31 @@ if { $lang_test_file_found } {
     append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
-    # Test with available OpenACC device types.
-    global openacc_device_type
-    foreach openacc_device_type $openacc_device_types_s {
+    # Test with all available offload targets, and with offloading disabled.
+    foreach offload_target [concat [split $offload_targets ","] "disable"] {
+	global openacc_device_type
+	set openacc_device_type [offload_target_to_openacc_device_type $offload_target]
 	set tagopt "-DACC_DEVICE_TYPE_$openacc_device_type=1"
 
 	switch $openacc_device_type {
+	    "" {
+		unsupported "$subdir $offload_target offloading"
+		continue
+	    }
 	    host {
 		set acc_mem_shared 1
 	    }
 	    nvidia {
 		if { ![check_effective_target_openacc_nvidia_accel_present] } {
 		    # Don't bother; execution testing is going to FAIL.
-		    untested "$subdir $openacc_device_type offloading: supported, but hardware not accessible"
+		    untested "$subdir $offload_target offloading: supported, but hardware not accessible"
 		    continue
 		}
 
 		set acc_mem_shared 0
 	    }
 	    default {
-		error "Unknown OpenACC device type: $openacc_device_type"
+		error "Unknown OpenACC device type: $openacc_device_type (offload target: $offload_target)"
 	    }
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
-- 
2.17.1

From a424204c2f9ea7955002db0dbd61c986bb955f6c Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 22 Feb 2019 10:51:35 +0000
Subject: [PATCH 8/9] [libgomp] In OpenACC testing, by default only build for
 the offload target that we're actually going to test

... to avoid compilation overhead, and to keep simple '-foffload=[...]'
handling in test cases.

	libgomp/
	* testsuite/libgomp.oacc-c++/c++.exp: Specify
	"-foffload=$offload_target".
	* testsuite/libgomp.oacc-c/c.exp: Likewise.
	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
	* testsuite/lib/libgomp.exp
	(check_effective_target_openacc_nvidia_accel_configured): Remove,
	as (conceptually) merged into
	check_effective_target_openacc_nvidia_accel_selected.  Adjust all
	users.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269109 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                                    | 10 ++++++++++
 libgomp/testsuite/lib/libgomp.exp                    | 12 ------------
 libgomp/testsuite/libgomp.oacc-c++/c++.exp           |  5 +++++
 .../function-not-offloaded.c                         |  4 ++--
 .../libgomp.oacc-c-c++-common/parallel-dims.c        | 10 +++++-----
 .../libgomp.oacc-c-c++-common/vector-length-64-1.c   |  2 +-
 libgomp/testsuite/libgomp.oacc-c/c.exp               |  5 +++++
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp   |  5 +++++
 8 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 53a5511b033..41ee3ed60c5 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,15 @@
 2019-02-22  Thomas Schwinge  <tho...@codesourcery.com>
 
+	* testsuite/libgomp.oacc-c++/c++.exp: Specify
+	"-foffload=$offload_target".
+	* testsuite/libgomp.oacc-c/c.exp: Likewise.
+	* testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+	* testsuite/lib/libgomp.exp
+	(check_effective_target_openacc_nvidia_accel_configured): Remove,
+	as (conceptually) merged into
+	check_effective_target_openacc_nvidia_accel_selected.  Adjust all
+	users.
+
 	* plugin/configfrag.ac: Populate and AC_SUBST offload_targets.
 	* testsuite/libgomp-test-support.exp.in: Adjust.
 	* testsuite/lib/libgomp.exp: Likewise.  Don't populate
diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index cb75e06c585..14d9b5f1305 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -362,18 +362,6 @@ proc check_effective_target_offload_device_shared_as { } {
     } ]
 }
 
-# Return 1 if configured for 'nvptx' offloading.
-
-proc check_effective_target_openacc_nvidia_accel_configured { } {
-    global offload_targets
-    if { ![string match "*,nvptx*,*" ",$offload_targets,"] } {
-        return 0
-    }
-    # PR libgomp/65099: Currently, we only support offloading in 64-bit
-    # configurations.
-    return [is-effective-target lp64]
-}
-
 # Return 1 if at least one Nvidia GPU is accessible.
 
 proc check_effective_target_openacc_nvidia_accel_present { } {
diff --git a/libgomp/testsuite/libgomp.oacc-c++/c++.exp b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 29805c67bad..dcefa792ca4 100644
--- a/libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ b/libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -112,6 +112,11 @@ if { $lang_test_file_found } {
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
+	# To avoid compilation overhead, and to keep simple '-foffload=[...]'
+	# handling in test cases, by default only build for the offload target
+	# that we're actually going to test.
+	set tagopt "$tagopt -foffload=$offload_target"
+	# Force usage of the corresponding OpenACC device type.
 	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# To get better test coverage for device-specific code that is only
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/function-not-offloaded.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/function-not-offloaded.c
index c94f268462f..fdf4eb08f8a 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/function-not-offloaded.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/function-not-offloaded.c
@@ -1,11 +1,11 @@
 /* { dg-do link } */
-/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target openacc_nvidia_accel_configured } } */
+/* { dg-excess-errors "lto1, mkoffload and lto-wrapper fatal errors" { target openacc_nvidia_accel_selected } } */
 
 int var;
 #pragma acc declare create (var)
 
 void __attribute__((noinline, noclone))
-foo () /* { dg-error "function 'foo' has been referenced in offloaded code but hasn't been marked to be included in the offloaded code" "" { target openacc_nvidia_accel_configured } } */
+foo () /* { dg-error "function 'foo' has been referenced in offloaded code but hasn't been marked to be included in the offloaded code" "" { target openacc_nvidia_accel_selected } } */
 {
   var++;
 }
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims.c
index d7cd0461b53..7e699f476b2 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/parallel-dims.c
@@ -154,7 +154,7 @@ int main ()
     int gangs_min, gangs_max, workers_min, workers_max, vectors_min, vectors_max;
     gangs_min = workers_min = vectors_min = INT_MAX;
     gangs_max = workers_max = vectors_max = INT_MIN;
-#pragma acc parallel copy (vectors_actual) /* { dg-warning "using vector_length \\(32\\), ignoring 1" "" { target openacc_nvidia_accel_configured } } */ \
+#pragma acc parallel copy (vectors_actual) /* { dg-warning "using vector_length \\(32\\), ignoring 1" "" { target openacc_nvidia_accel_selected } } */ \
   vector_length (VECTORS) /* { dg-warning "'vector_length' value must be positive" "" { target c++ } } */
     {
       /* We're actually executing with vector_length (1), just the GCC nvptx
@@ -265,7 +265,7 @@ int main ()
     int gangs_min, gangs_max, workers_min, workers_max, vectors_min, vectors_max;
     gangs_min = workers_min = vectors_min = INT_MAX;
     gangs_max = workers_max = vectors_max = INT_MIN;
-#pragma acc parallel copy (workers_actual) /* { dg-warning "using num_workers \\(32\\), ignoring 2097152" "" { target openacc_nvidia_accel_configured } } */ \
+#pragma acc parallel copy (workers_actual) /* { dg-warning "using num_workers \\(32\\), ignoring 2097152" "" { target openacc_nvidia_accel_selected } } */ \
   num_workers (WORKERS)
     {
       if (acc_on_device (acc_device_host))
@@ -350,7 +350,7 @@ int main ()
     int gangs_min, gangs_max, workers_min, workers_max, vectors_min, vectors_max;
     gangs_min = workers_min = vectors_min = INT_MAX;
     gangs_max = workers_max = vectors_max = INT_MIN;
-#pragma acc parallel copy (vectors_actual) /* { dg-warning "using vector_length \\(1024\\), ignoring 2097152" "" { target openacc_nvidia_accel_configured } } */ \
+#pragma acc parallel copy (vectors_actual) /* { dg-warning "using vector_length \\(1024\\), ignoring 2097152" "" { target openacc_nvidia_accel_selected } } */ \
   vector_length (VECTORS)
     {
       if (acc_on_device (acc_device_host))
@@ -390,7 +390,7 @@ int main ()
     int gangs_min, gangs_max, workers_min, workers_max, vectors_min, vectors_max;
     gangs_min = workers_min = vectors_min = INT_MAX;
     gangs_max = workers_max = vectors_max = INT_MIN;
-#pragma acc parallel copy (vectors_actual) /* { dg-warning "using vector_length \\(32\\), ignoring runtime setting" "" { target openacc_nvidia_accel_configured } } */ \
+#pragma acc parallel copy (vectors_actual) /* { dg-warning "using vector_length \\(32\\), ignoring runtime setting" "" { target openacc_nvidia_accel_selected } } */ \
   vector_length (vectors)
     {
       if (acc_on_device (acc_device_host))
@@ -437,7 +437,7 @@ int main ()
     int gangs_min, gangs_max, workers_min, workers_max, vectors_min, vectors_max;
     gangs_min = workers_min = vectors_min = INT_MAX;
     gangs_max = workers_max = vectors_max = INT_MIN;
-#pragma acc parallel copy (gangs_actual, workers_actual, vectors_actual) /* { dg-warning "using vector_length \\(32\\), ignoring 11" "" { target openacc_nvidia_accel_configured } } */ \
+#pragma acc parallel copy (gangs_actual, workers_actual, vectors_actual) /* { dg-warning "using vector_length \\(32\\), ignoring 11" "" { target openacc_nvidia_accel_selected } } */ \
   num_gangs (gangs) \
   num_workers (WORKERS) \
   vector_length (VECTORS)
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/vector-length-64-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/vector-length-64-1.c
index b6ee732f863..2d57ad4464a 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/vector-length-64-1.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/vector-length-64-1.c
@@ -4,7 +4,7 @@
 int
 main (void)
 {
-#pragma acc parallel vector_length (64) num_workers (16) /* { dg-warning "using num_workers \\(15\\), ignoring 16" "" { target openacc_nvidia_accel_configured } } */
+#pragma acc parallel vector_length (64) num_workers (16) /* { dg-warning "using num_workers \\(15\\), ignoring 16" "" { target openacc_nvidia_accel_selected } } */
   {
 #pragma acc loop worker
     for (unsigned int i = 0; i < 32; i++)
diff --git a/libgomp/testsuite/libgomp.oacc-c/c.exp b/libgomp/testsuite/libgomp.oacc-c/c.exp
index 2cd75be0cc7..55cd40f1e99 100644
--- a/libgomp/testsuite/libgomp.oacc-c/c.exp
+++ b/libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -75,6 +75,11 @@ foreach offload_target [concat [split $offload_targets ","] "disable"] {
     }
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
+    # To avoid compilation overhead, and to keep simple '-foffload=[...]'
+    # handling in test cases, by default only build for the offload target
+    # that we're actually going to test.
+    set tagopt "$tagopt -foffload=$offload_target"
+    # Force usage of the corresponding OpenACC device type.
     setenv ACC_DEVICE_TYPE $openacc_device_type
 
     # To get better test coverage for device-specific code that is only
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index b2baa73d91a..af25a22a522 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ b/libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -94,6 +94,11 @@ if { $lang_test_file_found } {
 	}
 	set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
+	# To avoid compilation overhead, and to keep simple '-foffload=[...]'
+	# handling in test cases, by default only build for the offload target
+	# that we're actually going to test.
+	set tagopt "$tagopt -foffload=$offload_target"
+	# Force usage of the corresponding OpenACC device type.
 	setenv ACC_DEVICE_TYPE $openacc_device_type
 
 	# For Fortran we're doing torture testing, as Fortran has far more tests
-- 
2.17.1

From b320319b23606c940bd8ede777a51276f666a634 Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 22 Feb 2019 10:51:52 +0000
Subject: [PATCH 9/9] Remove unused check_effective_target_offload_nvptx

	gcc/testsuite/
	* lib/target-supports.exp (check_effective_target_offload_nvptx):
	Remove.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269110 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/testsuite/ChangeLog               | 3 +++
 gcc/testsuite/lib/target-supports.exp | 8 --------
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index dec48441f30..709e1b1ee04 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
 2019-02-22  Thomas Schwinge  <tho...@codesourcery.com>
 
+	* lib/target-supports.exp (check_effective_target_offload_nvptx):
+	Remove.
+
 	PR fortran/72741
 	* gfortran.dg/goacc/classify-routine.f95: Adjust.
 
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index bf64b2b29e1..b63d1e7a1a6 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8900,14 +8900,6 @@ proc check_effective_target_vect_max_reduc { } {
     return 0
 }
 
-# Return 1 if there is an nvptx offload compiler.
-
-proc check_effective_target_offload_nvptx { } {
-    return [check_no_compiler_messages offload_nvptx object {
-	int main () {return 0;}
-    } "-foffload=nvptx-none" ]
-}
-
 # Return 1 if the compiler has been configured with hsa offloading.
 
 proc check_effective_target_offload_hsa { } {
-- 
2.17.1

Attachment: signature.asc
Description: PGP signature

Reply via email to