From: Thomas Schwinge <tho...@codesourcery.com> gcc/ * gimplify.c (gimplify_body): Consider flag_openacc additionally to flag_openmp. * omp-low.c (execute_expand_omp, execute_lower_omp) (gate_diagnose_omp_blocks): Likewise. gcc/testsuite/ * gcc.dg/goacc-gomp/goacc-gomp.exp: New file. * gcc.dg/goacc/goacc.exp: Likewise. --- gcc/gimplify.c | 4 +-- gcc/omp-low.c | 10 ++++--- gcc/testsuite/gcc.dg/goacc-gomp/goacc-gomp.exp | 38 ++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/goacc/goacc.exp | 37 +++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/goacc-gomp/goacc-gomp.exp create mode 100644 gcc/testsuite/gcc.dg/goacc/goacc.exp
diff --git gcc/gimplify.c gcc/gimplify.c index 1f18466..30c2b45 100644 --- gcc/gimplify.c +++ gcc/gimplify.c @@ -8803,7 +8803,7 @@ gimplify_body (tree fndecl, bool do_parms) gcc_assert (gimplify_ctxp == NULL); push_gimplify_context (&gctx); - if (flag_openmp) + if (flag_openacc || flag_openmp) { gcc_assert (gimplify_omp_ctxp == NULL); if (lookup_attribute ("omp declare target", DECL_ATTRIBUTES (fndecl))) @@ -8872,7 +8872,7 @@ gimplify_body (tree fndecl, bool do_parms) nonlocal_vlas = NULL; } - if (flag_openmp && gimplify_omp_ctxp) + if ((flag_openacc || flag_openmp) && gimplify_omp_ctxp) { delete_omp_context (gimplify_omp_ctxp); gimplify_omp_ctxp = NULL; diff --git gcc/omp-low.c gcc/omp-low.c index 94058af..99811d0 100644 --- gcc/omp-low.c +++ gcc/omp-low.c @@ -8234,7 +8234,8 @@ execute_expand_omp (void) static bool gate_expand_omp (void) { - return (flag_openmp != 0 && !seen_error ()); + return ((flag_openacc || flag_openmp) + && !seen_error ()); } namespace { @@ -10054,8 +10055,9 @@ execute_lower_omp (void) gimple_seq body; /* This pass always runs, to provide PROP_gimple_lomp. - But there is nothing to do unless -fopenmp is given. */ - if (flag_openmp == 0) + But there is nothing to do unless at least one of -fopenacc or -fopenmp is + given. */ + if (!(flag_openacc || flag_openmp)) return 0; all_contexts = splay_tree_new (splay_tree_compare_pointers, 0, @@ -10484,7 +10486,7 @@ diagnose_omp_structured_block_errors (void) static bool gate_diagnose_omp_blocks (void) { - return flag_openmp != 0; + return flag_openacc || flag_openmp; } namespace { diff --git gcc/testsuite/gcc.dg/goacc-gomp/goacc-gomp.exp gcc/testsuite/gcc.dg/goacc-gomp/goacc-gomp.exp new file mode 100644 index 0000000..29e9a93 --- /dev/null +++ gcc/testsuite/gcc.dg/goacc-gomp/goacc-gomp.exp @@ -0,0 +1,38 @@ +# Copyright (C) 2006-2013 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +if { ![check_effective_target_fopenacc] \ + || ![check_effective_target_fopenmp] } { + return +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [concat \ + [find $srcdir/$subdir *.c] \ + [find $srcdir/c-c++-common/goacc-gomp *.c]]] "" "-fopenacc -fopenmp" + +# All done. +dg-finish diff --git gcc/testsuite/gcc.dg/goacc/goacc.exp gcc/testsuite/gcc.dg/goacc/goacc.exp new file mode 100644 index 0000000..1137c99 --- /dev/null +++ gcc/testsuite/gcc.dg/goacc/goacc.exp @@ -0,0 +1,37 @@ +# Copyright (C) 2006-2013 Free Software Foundation, Inc. +# +# This file is part of GCC. +# +# GCC is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GCC is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. + +# GCC testsuite that uses the `dg.exp' driver. + +# Load support procs. +load_lib gcc-dg.exp + +if ![check_effective_target_fopenacc] { + return +} + +# Initialize `dg'. +dg-init + +# Main loop. +dg-runtest [lsort [concat \ + [find $srcdir/$subdir *.c] \ + [find $srcdir/c-c++-common/goacc *.c]]] "" "-fopenacc" + +# All done. +dg-finish -- 1.8.1.1