diff mbox series

[og8] OpenACC 'kernels' construct changes: splitting of the construct into several regions

Message ID yxfp7eeke5ul.fsf@hertz.schwinge.homeip.net
State New
Headers show
Series [og8] OpenACC 'kernels' construct changes: splitting of the construct into several regions | expand

Commit Message

Thomas Schwinge Jan. 31, 2019, 11:59 p.m. UTC
Hi!

I've just pushed the attached nine patches to openacc-gcc-8-branch:
OpenACC 'kernels' construct changes: splitting of the construct into
several regions.

There's more work to be done there, and we're aware of a number of TODO
items, but nevertheless: it's a good first step.


(Tom, CCed you just for your information, as you've been working on the
OpenACC 'kernels' construct before.)


Grüße
 Thomas

Comments

Thomas Schwinge Feb. 1, 2019, 7:48 p.m. UTC | #1
Hi!

On Fri, 01 Feb 2019 00:59:30 +0100, I wrote:
> From c7713be32fc5eace2b1e9c20447da849d23f6076 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Gerg=C3=B6=20Barany?= <gergo@codesourcery.com>
> Date: Wed, 23 Jan 2019 22:11:11 -0800
> Subject: [PATCH 6/9] Adjust parallelism of loops in gang-single parts of
>  OpenACC kernels regions

>  transform_kernels_loop_clauses (gimple *omp_for,

> +  struct walk_stmt_info wi;
> +  memset (&wi, 0, sizeof (wi));
> +  tree *num_clauses[GOMP_DIM_MAX]
> +    = { [GOMP_DIM_GANG] = &loop_gang_clause,
> +        [GOMP_DIM_WORKER] = &loop_worker_clause,
> +        [GOMP_DIM_VECTOR] = &loop_vector_clause };
> +  wi.info = num_clauses;
> +  gimple *body = gimple_omp_body (omp_for);
> +  walk_gimple_seq (body, adjust_nested_loop_clauses, NULL, &wi);

It makes sense to me, but not to GCC 4.6 ;-) -- pushed to
openacc-gcc-8-branch the attached commit
5885db6f8466e13ddfab046bae3149a992a30926 'Adjust parallelism of loops in
gang-single parts of OpenACC kernels regions: "struct
adjust_nested_loop_clauses_wi_info"'.


Grüße
 Thomas
From 5885db6f8466e13ddfab046bae3149a992a30926 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Fri, 1 Feb 2019 18:12:05 +0100
Subject: [PATCH] Adjust parallelism of loops in gang-single parts of OpenACC
 kernels regions: "struct adjust_nested_loop_clauses_wi_info"

The current code apparently is too freaky at least for for GCC 4.6:

    [...]/gcc/omp-oacc-kernels.c: In function 'tree_node* transform_kernels_loop_clauses(gimple*, tree, tree, tree, tree)':
    [...]/gcc/omp-oacc-kernels.c:584:10: error: expected identifier before numeric constant
    [...]/gcc/omp-oacc-kernels.c: In lambda function:
    [...]/gcc/omp-oacc-kernels.c:584:25: error: expected '{' before '=' token
    [...]/gcc/omp-oacc-kernels.c: In function 'tree_node* transform_kernels_loop_clauses(gimple*, tree, tree, tree, tree)':
    [...]/gcc/omp-oacc-kernels.c:584:25: warning: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]
    [...]/gcc/omp-oacc-kernels.c:584:28: error: no match for 'operator=' in '{} = & loop_gang_clause'
    [...]

	gcc/
	* omp-oacc-kernels.c (struct adjust_nested_loop_clauses_wi_info): New.
	(adjust_nested_loop_clauses, transform_kernels_loop_clauses): Use it.
---
 gcc/ChangeLog.openacc  |  5 +++++
 gcc/omp-oacc-kernels.c | 29 +++++++++++++++++------------
 2 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/gcc/ChangeLog.openacc b/gcc/ChangeLog.openacc
index 433653b2b38..a3472637729 100644
--- a/gcc/ChangeLog.openacc
+++ b/gcc/ChangeLog.openacc
@@ -1,3 +1,8 @@
+2019-02-01  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* omp-oacc-kernels.c (struct adjust_nested_loop_clauses_wi_info): New.
+	(adjust_nested_loop_clauses, transform_kernels_loop_clauses): Use it.
+
 2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* doc/invoke.texi (-fopenacc-kernels): Update.
diff --git a/gcc/omp-oacc-kernels.c b/gcc/omp-oacc-kernels.c
index a8860c98e11..d1db4924b1c 100644
--- a/gcc/omp-oacc-kernels.c
+++ b/gcc/omp-oacc-kernels.c
@@ -409,14 +409,19 @@ add_parent_or_loop_num_clause (tree parent_clause, tree loop_clause,
    nested loops.  It adds an auto clause unless there is already an
    independent/seq/auto clause or a gang/worker/vector annotation.  */
 
+struct adjust_nested_loop_clauses_wi_info
+{
+  tree *loop_gang_clause_ptr;
+  tree *loop_worker_clause_ptr;
+  tree *loop_vector_clause_ptr;
+};
+
 static tree
 adjust_nested_loop_clauses (gimple_stmt_iterator *gsi_p, bool *,
                             struct walk_stmt_info *wi)
 {
-  tree **clauses = (tree **) wi->info;
-  tree *gang_num_clause = clauses[GOMP_DIM_GANG];
-  tree *worker_num_clause = clauses[GOMP_DIM_WORKER];
-  tree *vector_length_clause = clauses[GOMP_DIM_VECTOR];
+  struct adjust_nested_loop_clauses_wi_info *wi_info
+    = (struct adjust_nested_loop_clauses_wi_info *) wi->info;
   gimple *stmt = gsi_stmt (*gsi_p);
 
   if (gimple_code (stmt) == GIMPLE_OMP_FOR)
@@ -430,13 +435,13 @@ adjust_nested_loop_clauses (gimple_stmt_iterator *gsi_p, bool *,
           switch (OMP_CLAUSE_CODE (loop_clause))
             {
               case OMP_CLAUSE_GANG:
-                outer_clause_ptr = gang_num_clause;
+                outer_clause_ptr = wi_info->loop_gang_clause_ptr;
                 break;
               case OMP_CLAUSE_WORKER:
-                outer_clause_ptr = worker_num_clause;
+                outer_clause_ptr = wi_info->loop_worker_clause_ptr;
                 break;
               case OMP_CLAUSE_VECTOR:
-                outer_clause_ptr = vector_length_clause;
+                outer_clause_ptr = wi_info->loop_vector_clause_ptr;
                 break;
               case OMP_CLAUSE_INDEPENDENT:
               case OMP_CLAUSE_SEQ:
@@ -580,11 +585,11 @@ transform_kernels_loop_clauses (gimple *omp_for,
      Turn these into worker/vector annotations on the parallel region.  */
   struct walk_stmt_info wi;
   memset (&wi, 0, sizeof (wi));
-  tree *num_clauses[GOMP_DIM_MAX]
-    = { [GOMP_DIM_GANG] = &loop_gang_clause,
-        [GOMP_DIM_WORKER] = &loop_worker_clause,
-        [GOMP_DIM_VECTOR] = &loop_vector_clause };
-  wi.info = num_clauses;
+  struct adjust_nested_loop_clauses_wi_info wi_info;
+  wi_info.loop_gang_clause_ptr = &loop_gang_clause;
+  wi_info.loop_worker_clause_ptr = &loop_worker_clause;
+  wi_info.loop_vector_clause_ptr = &loop_vector_clause;
+  wi.info = &wi_info;
   gimple *body = gimple_omp_body (omp_for);
   walk_gimple_seq (body, adjust_nested_loop_clauses, NULL, &wi);
   /* Check if there were conflicting numbers of workers or vector lanes.  */
diff mbox series

Patch

From 53f61640a510d13537709239d523c283881f0755 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Wed, 23 Jan 2019 02:40:08 -0800
Subject: [PATCH 9/9] Make new OpenACC kernels conversion the default; adjust
 and add tests

	gcc/c-family/
	* c.opt (fopenacc-kernels): Default to "split".
	gcc/fortran/
	* lang.opt (fopenacc-kernels): Default to "split".
	gcc/
	* doc/invoke.texi (-fopenacc-kernels): Update.
	gcc/testsuite/
	* c-c++-common/goacc/note-parallelism-1-kernels-conditional-loop-independent_seq.c:
	New file.
	* c-c++-common/goacc/note-parallelism-1-kernels-loop-auto.c:
	Likewise.
	* c-c++-common/goacc/note-parallelism-1-kernels-loop-independent_seq.c:
	Likewise.
	* c-c++-common/goacc/note-parallelism-1-kernels-loops.c: Likewise.
	* c-c++-common/goacc/note-parallelism-1-kernels-straight-line.c:
	Likewise.
	* c-c++-common/goacc/note-parallelism-combined-kernels-loop-auto.c:
	Likewise.
	* c-c++-common/goacc/note-parallelism-combined-kernels-loop-independent_seq.c:
	Likewise.
	* c-c++-common/goacc/note-parallelism-kernels-conditional-loop-independent_seq.c:
	Likewise.
	* c-c++-common/goacc/note-parallelism-kernels-loop-auto.c:
	Likewise.
	* c-c++-common/goacc/note-parallelism-kernels-loop-independent_seq.c:
	Likewise.
	* c-c++-common/goacc/note-parallelism-kernels-loops.c: Likewise.
	* c-c++-common/goacc/classify-kernels-unparallelized.c: Update.
	* c-c++-common/goacc/classify-kernels.c: Likewise.
	* c-c++-common/goacc/classify-parallel.c: Likewise.
	* c-c++-common/goacc/classify-routine.c: Likewise.
	* c-c++-common/goacc/dtype-1.c: Likewise.
	* c-c++-common/goacc/if-clause-2.c: Likewise.
	* c-c++-common/goacc/kernels-conversion.c: Likewise.
	* c-c++-common/goacc/kernels-decompose-1.c: Likewise.
	* c-c++-common/goacc/loop-2-kernels.c: Likewise.
	* c-c++-common/goacc/note-parallelism.c: Likewise.
	* c-c++-common/goacc/routine-1.c: Likewise.
	* c-c++-common/goacc/uninit-dim-clause.c: Likewise.
	* gfortran.dg/goacc/dtype-1.f95: Likewise.
	* gfortran.dg/goacc/kernels-conversion.f95: Likewise.
	* gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
	* gfortran.dg/goacc/kernels-tree.f95: Likewise.
	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c:
	Update.
	* testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/avoid-offloading-3.c:
	Likewise.
	* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
	Likewise.
	* testsuite/libgomp.oacc-fortran/avoid-offloading-1.f: Likewise.
	* testsuite/libgomp.oacc-fortran/avoid-offloading-2.f: Likewise.
	* testsuite/libgomp.oacc-fortran/avoid-offloading-3.f: Likewise.
	* testsuite/libgomp.oacc-fortran/initialize_kernels_loops.f90:
	Likewise.
---
 gcc/ChangeLog.openacc                         |   4 +
 gcc/c-family/ChangeLog.openacc                |   4 +
 gcc/c-family/c.opt                            |   2 +-
 gcc/doc/invoke.texi                           |   2 +-
 gcc/fortran/ChangeLog.openacc                 |   4 +
 gcc/fortran/lang.opt                          |   2 +-
 gcc/testsuite/ChangeLog.openacc               |  40 ++++
 .../goacc/classify-kernels-unparallelized.c   |   7 +-
 .../c-c++-common/goacc/classify-kernels.c     |   2 +-
 .../c-c++-common/goacc/classify-parallel.c    |   2 +-
 .../c-c++-common/goacc/classify-routine.c     |   2 +-
 gcc/testsuite/c-c++-common/goacc/dtype-1.c    |   8 +-
 .../c-c++-common/goacc/if-clause-2.c          |   1 -
 .../c-c++-common/goacc/kernels-conversion.c   |  10 +-
 .../c-c++-common/goacc/kernels-decompose-1.c  |   1 -
 .../c-c++-common/goacc/loop-2-kernels.c       |  14 +-
 ...kernels-conditional-loop-independent_seq.c | 129 +++++++++++
 .../note-parallelism-1-kernels-loop-auto.c    | 126 +++++++++++
 ...rallelism-1-kernels-loop-independent_seq.c | 126 +++++++++++
 .../goacc/note-parallelism-1-kernels-loops.c  |  47 ++++
 ...note-parallelism-1-kernels-straight-line.c |  82 +++++++
 ...e-parallelism-combined-kernels-loop-auto.c | 121 +++++++++++
 ...sm-combined-kernels-loop-independent_seq.c | 121 +++++++++++
 ...kernels-conditional-loop-independent_seq.c | 204 ++++++++++++++++++
 .../note-parallelism-kernels-loop-auto.c      | 138 ++++++++++++
 ...parallelism-kernels-loop-independent_seq.c | 138 ++++++++++++
 .../goacc/note-parallelism-kernels-loops.c    |  50 +++++
 .../c-c++-common/goacc/note-parallelism.c     |   3 +-
 gcc/testsuite/c-c++-common/goacc/routine-1.c  |   2 +-
 .../c-c++-common/goacc/uninit-dim-clause.c    |   6 +-
 gcc/testsuite/gfortran.dg/goacc/dtype-1.f95   |   8 +-
 .../gfortran.dg/goacc/kernels-conversion.f95  |   7 +-
 .../gfortran.dg/goacc/kernels-decompose-1.f95 |   1 -
 .../gfortran.dg/goacc/kernels-tree.f95        |   1 -
 libgomp/ChangeLog.openacc                     |  16 ++
 .../acc_prof-kernels-1.c                      |  17 +-
 .../avoid-offloading-1.c                      |  18 +-
 .../avoid-offloading-2.c                      |  17 +-
 .../avoid-offloading-3.c                      |  14 +-
 .../kernels-decompose-1.c                     |   3 +-
 .../libgomp.oacc-fortran/avoid-offloading-1.f |  18 +-
 .../libgomp.oacc-fortran/avoid-offloading-2.f |  18 +-
 .../libgomp.oacc-fortran/avoid-offloading-3.f |  15 +-
 .../initialize_kernels_loops.f90              |   1 -
 44 files changed, 1494 insertions(+), 58 deletions(-)
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-conditional-loop-independent_seq.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loop-auto.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loop-independent_seq.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loops.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-straight-line.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-combined-kernels-loop-auto.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-combined-kernels-loop-independent_seq.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-conditional-loop-independent_seq.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loop-auto.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loop-independent_seq.c
 create mode 100644 gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loops.c

diff --git a/gcc/ChangeLog.openacc b/gcc/ChangeLog.openacc
index 3ef97adef47..433653b2b38 100644
--- a/gcc/ChangeLog.openacc
+++ b/gcc/ChangeLog.openacc
@@ -1,3 +1,7 @@ 
+2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* doc/invoke.texi (-fopenacc-kernels): Update.
+
 2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
 	    Gergö Barany  <gergo@codesourcery.com>
 
diff --git a/gcc/c-family/ChangeLog.openacc b/gcc/c-family/ChangeLog.openacc
index 5b60c3a0dee..39d51c53808 100644
--- a/gcc/c-family/ChangeLog.openacc
+++ b/gcc/c-family/ChangeLog.openacc
@@ -1,3 +1,7 @@ 
+2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* c.opt (fopenacc-kernels): Default to "split".
+
 2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* c.opt (fopenacc-kernels): New flag.
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 12f8f55c50f..7b7a90e938a 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -1618,7 +1618,7 @@  C ObjC C++ ObjC++ LTO Joined Var(flag_openacc_dims)
 Specify default OpenACC compute dimensions.
 
 fopenacc-kernels=
-C ObjC C++ ObjC++ RejectNegative Joined Enum(openacc_kernels) Var(flag_openacc_kernels) Init(OPENACC_KERNELS_PARLOOPS)
+C ObjC C++ ObjC++ RejectNegative Joined Enum(openacc_kernels) Var(flag_openacc_kernels) Init(OPENACC_KERNELS_SPLIT)
 -fopenacc-kernels=[split|parloops]	Configure OpenACC 'kernels' constructs handling.
 
 Enum
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 3bbeb8c6839..569c02d1e96 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -2165,9 +2165,9 @@  Configure OpenACC 'kernels' constructs handling.
 With @option{-fopenacc-kernels=split}, OpenACC 'kernels' constructs
 are split into a sequence of compute constructs, each then handled
 individually.
+This is the default.
 With @option{-fopenacc-kernels=parloops}, the whole OpenACC
 'kernels' constructs is handled by the @samp{parloops} pass.
-This is the default.
 
 @item -fopenmp
 @opindex fopenmp
diff --git a/gcc/fortran/ChangeLog.openacc b/gcc/fortran/ChangeLog.openacc
index acb2177f22f..2715d7aa195 100644
--- a/gcc/fortran/ChangeLog.openacc
+++ b/gcc/fortran/ChangeLog.openacc
@@ -1,3 +1,7 @@ 
+2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* lang.opt (fopenacc-kernels): Default to "split".
+
 2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
 
 	* lang.opt (fopenacc-kernels): New flag.
diff --git a/gcc/fortran/lang.opt b/gcc/fortran/lang.opt
index b3c9cdb425f..19199aeccbc 100644
--- a/gcc/fortran/lang.opt
+++ b/gcc/fortran/lang.opt
@@ -643,7 +643,7 @@  Fortran LTO Joined Var(flag_openacc_dims)
 ; Documented in C
 
 fopenacc-kernels=
-Fortran RejectNegative Joined Enum(openacc_kernels) Var(flag_openacc_kernels) Init(OPENACC_KERNELS_PARLOOPS)
+Fortran RejectNegative Joined Enum(openacc_kernels) Var(flag_openacc_kernels) Init(OPENACC_KERNELS_SPLIT)
 ; Documented in C
 
 fopenmp
diff --git a/gcc/testsuite/ChangeLog.openacc b/gcc/testsuite/ChangeLog.openacc
index 3b4a9c8370d..5dd6d7d656c 100644
--- a/gcc/testsuite/ChangeLog.openacc
+++ b/gcc/testsuite/ChangeLog.openacc
@@ -1,3 +1,43 @@ 
+2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
+	    Gergö Barany  <gergo@codesourcery.com>
+
+	* c-c++-common/goacc/note-parallelism-1-kernels-conditional-loop-independent_seq.c:
+	New file.
+	* c-c++-common/goacc/note-parallelism-1-kernels-loop-auto.c:
+	Likewise.
+	* c-c++-common/goacc/note-parallelism-1-kernels-loop-independent_seq.c:
+	Likewise.
+	* c-c++-common/goacc/note-parallelism-1-kernels-loops.c: Likewise.
+	* c-c++-common/goacc/note-parallelism-1-kernels-straight-line.c:
+	Likewise.
+	* c-c++-common/goacc/note-parallelism-combined-kernels-loop-auto.c:
+	Likewise.
+	* c-c++-common/goacc/note-parallelism-combined-kernels-loop-independent_seq.c:
+	Likewise.
+	* c-c++-common/goacc/note-parallelism-kernels-conditional-loop-independent_seq.c:
+	Likewise.
+	* c-c++-common/goacc/note-parallelism-kernels-loop-auto.c:
+	Likewise.
+	* c-c++-common/goacc/note-parallelism-kernels-loop-independent_seq.c:
+	Likewise.
+	* c-c++-common/goacc/note-parallelism-kernels-loops.c: Likewise.
+	* c-c++-common/goacc/classify-kernels-unparallelized.c: Update.
+	* c-c++-common/goacc/classify-kernels.c: Likewise.
+	* c-c++-common/goacc/classify-parallel.c: Likewise.
+	* c-c++-common/goacc/classify-routine.c: Likewise.
+	* c-c++-common/goacc/dtype-1.c: Likewise.
+	* c-c++-common/goacc/if-clause-2.c: Likewise.
+	* c-c++-common/goacc/kernels-conversion.c: Likewise.
+	* c-c++-common/goacc/kernels-decompose-1.c: Likewise.
+	* c-c++-common/goacc/loop-2-kernels.c: Likewise.
+	* c-c++-common/goacc/note-parallelism.c: Likewise.
+	* c-c++-common/goacc/routine-1.c: Likewise.
+	* c-c++-common/goacc/uninit-dim-clause.c: Likewise.
+	* gfortran.dg/goacc/dtype-1.f95: Likewise.
+	* gfortran.dg/goacc/kernels-conversion.f95: Likewise.
+	* gfortran.dg/goacc/kernels-decompose-1.f95: Likewise.
+	* gfortran.dg/goacc/kernels-tree.f95: Likewise.
+
 2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
 	    Gergö Barany  <gergo@codesourcery.com>
 
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
index 64467774037..61caa2df236 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels-unparallelized.c
@@ -1,5 +1,5 @@ 
 /* Check offloaded function's attributes and classification for unparallelized
-   OpenACC kernels.  */
+   OpenACC 'kernels'.  */
 
 /* { dg-additional-options "-O2" }
    { dg-additional-options "-fopt-info-optimized-omp" }
@@ -13,14 +13,15 @@  extern unsigned int *__restrict a;
 extern unsigned int *__restrict b;
 extern unsigned int *__restrict c;
 
-/* An "extern"al mapping of loop iterations/array indices makes the loop
-   unparallelizable.  */
 extern unsigned int f (unsigned int);
+#pragma acc routine (f) seq
 
 void KERNELS ()
 {
 #pragma acc kernels copyin (a[0:N], b[0:N]) copyout (c[0:N]) /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
   for (unsigned int i = 0; i < N; i++)
+    /* An "extern"al mapping of loop iterations/array indices makes the loop
+       unparallelizable.  */
     c[i] = a[f (i)] + b[f (i)];
 }
 
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-kernels.c b/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
index c59a65e1d0f..eb78c8f5e40 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-kernels.c
@@ -1,5 +1,5 @@ 
 /* Check offloaded function's attributes and classification for OpenACC
-   kernels.  */
+   'kernels'.  */
 
 /* { dg-additional-options "-O2" }
    { dg-additional-options "-fopt-info-optimized-omp" }
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-parallel.c b/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
index b345c225aea..baa0bce004d 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-parallel.c
@@ -1,5 +1,5 @@ 
 /* Check offloaded function's attributes and classification for OpenACC
-   parallel.  */
+   'parallel'.  */
 
 /* { dg-additional-options "-O2" }
    { dg-additional-options "-fopt-info-optimized-omp" }
diff --git a/gcc/testsuite/c-c++-common/goacc/classify-routine.c b/gcc/testsuite/c-c++-common/goacc/classify-routine.c
index 5ca2ec9c603..094c9a760fa 100644
--- a/gcc/testsuite/c-c++-common/goacc/classify-routine.c
+++ b/gcc/testsuite/c-c++-common/goacc/classify-routine.c
@@ -1,5 +1,5 @@ 
 /* Check offloaded function's attributes and classification for OpenACC
-   routine.  */
+   'routine'.  */
 
 /* { dg-additional-options "-O2" }
    { dg-additional-options "-fopt-info-optimized-omp" }
diff --git a/gcc/testsuite/c-c++-common/goacc/dtype-1.c b/gcc/testsuite/c-c++-common/goacc/dtype-1.c
index 6dd6ebd8ae1..ae3de574dfc 100644
--- a/gcc/testsuite/c-c++-common/goacc/dtype-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/dtype-1.c
@@ -96,11 +96,13 @@  test ()
 
 /* { dg-final { scan-tree-dump-times "oacc_parallel device_type\\(\\*\\) \\\[ wait\\(10\\) vector_length\\(10\\) num_workers\\(10\\) num_gangs\\(10\\) async\\(10\\) \\\] device_type\\(nvidia\\) \\\[ wait\\(3\\) vector_length\\(128\\) num_workers\\(300\\) num_gangs\\(300\\) async\\(3\\) \\\] wait\\(1\\) vector_length\\(1\\) num_workers\\(1\\) num_gangs\\(1\\) async\\(1\\)" 1 "omplower" } } */
 
-/* { dg-final { scan-tree-dump-times "oacc_kernels device_type\\(nvidia\\) \\\[ wait\\(-1\\) async\\(-1\\) \\\]" 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single async\\(-1\\) num_gangs\\(1\\) device_type\\(nvidia\\) \\\[ wait\\(-1\\) async\\(-1\\) \\\]" 1 "omplower" } } */
 
-/* { dg-final { scan-tree-dump-times "oacc_kernels device_type\\(nvidia\\) \\\[ wait\\(1\\) async\\(1\\) \\\] wait\\(-1\\) async\\(-1\\)" 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single num_gangs\\(1\\) device_type\\(nvidia\\) \\\[ wait\\(1\\) async\\(1\\) \\\] wait\\(-1\\) async\\(-1\\)" 1 "omplower" } } */
 
-/* { dg-final { scan-tree-dump-times "oacc_kernels device_type\\(\\*\\) \\\[ wait\\(0\\) async\\(0\\) \\\] device_type\\(nvidia\\) \\\[ wait\\(2\\) async\\(2\\) \\\] wait\\(-1\\) async\\(-1\\)" 1 "omplower" } } */
+/* { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single num_gangs\\(1\\) device_type\\(\\*\\) \\\[ wait\\(0\\) async\\(0\\) \\\] device_type\\(nvidia\\) \\\[ wait\\(2\\) async\\(2\\) \\\] wait\\(-1\\) async\\(-1\\)" 1 "omplower" } } */
+
+/* { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single num_gangs\\(1\\) device_type\\(\\*\\) \\\[ wait\\(0\\) async\\(0\\) \\\] device_type\\(nvidia_ptx\\) \\\[ wait\\(1\\) async\\(1\\) \\\] wait\\(-1\\) async\\(-1\\)" 1 "omplower" } } */
 
 /* { dg-final { scan-tree-dump-times "acc loop device_type\\(nvidia\\) \\\[ tile\\(1\\) gang \\\] private\\(i1\\.0\\) private\\(i1\\)" 1 "omplower" } } */
 
diff --git a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
index e17b5dd1107..9920b4fd175 100644
--- a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
@@ -1,4 +1,3 @@ 
-/* { dg-additional-options "-fopenacc-kernels=split" } */
 /* { dg-additional-options "-fdump-tree-convert_oacc_kernels" } */
 
 void
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-conversion.c b/gcc/testsuite/c-c++-common/goacc/kernels-conversion.c
index ea7eec997fb..8cb63f00444 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-conversion.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-conversion.c
@@ -1,4 +1,3 @@ 
-/* { dg-additional-options "-fopenacc-kernels=split" } */
 /* { dg-additional-options "-fdump-tree-convert_oacc_kernels" } */
 
 #define N 1024
@@ -52,12 +51,11 @@  main (void)
    parallelized loop region; and three "old-style" kernel regions. */
 /* { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single" 1 "convert_oacc_kernels" } } */
 /* { dg-final { scan-tree-dump-times "oacc_parallel_kernels_parallelized" 1 "convert_oacc_kernels" } } */
-/* { dg-final { scan-tree-dump-times "oacc_kernels" 3 "convert_oacc_kernels" } } */
+/* { dg-final { scan-tree-dump-times "oacc_kernels " 3 "convert_oacc_kernels" } } */
 
 /* Each of the parallel regions is async, and there is a final call to
    __builtin_GOACC_wait.  */
-/* { dg-final { scan-tree-dump-times "oacc_parallel_kernels.* async\(-1\)" 5 "convert_oacc_kernels" } } */
+/* { dg-final { scan-tree-dump-times "oacc_kernels async\\(-1\\)" 3 "convert_oacc_kernels" } } */
+/* { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single async\\(-1\\)" 1 "convert_oacc_kernels" } } */
+/* { dg-final { scan-tree-dump-times "oacc_parallel_kernels_parallelized async\\(-1\\)" 1 "convert_oacc_kernels" } } */
 /* { dg-final { scan-tree-dump-times "__builtin_GOACC_wait" 1 "convert_oacc_kernels" } } */
-
-/* Check that the original kernels region is removed.  */
-/* { dg-final { scan-tree-dump-not "oacc_kernels" "convert_oacc_kernels" } } */
diff --git a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c
index b5d58c37200..7255d692e34 100644
--- a/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/kernels-decompose-1.c
@@ -1,6 +1,5 @@ 
 /* Test OpenACC 'kernels' construct decomposition.  */
 
-/* { dg-additional-options "-fopenacc-kernels=split" } */
 /* { dg-additional-options "-fopt-info-optimized-omp" } */
 /* { dg-additional-options "-O2" } for "parloops".  */
 
diff --git a/gcc/testsuite/c-c++-common/goacc/loop-2-kernels.c b/gcc/testsuite/c-c++-common/goacc/loop-2-kernels.c
index 2608c128b43..8b5c5e75c35 100644
--- a/gcc/testsuite/c-c++-common/goacc/loop-2-kernels.c
+++ b/gcc/testsuite/c-c++-common/goacc/loop-2-kernels.c
@@ -35,7 +35,7 @@  void K(void)
 	for (j = 0; j < 10; j++)
 	  { }
       }
-#pragma acc loop seq gang // { dg-error "'seq' overrides" }
+#pragma acc loop seq gang // { dg-error "'seq' overrides" "TODO" { xfail *-*-* } }
     for (i = 0; i < 10; i++)
       { }
 
@@ -61,7 +61,7 @@  void K(void)
 	for (j = 0; j < 10; j++)
 	  { }
       }
-#pragma acc loop seq worker // { dg-error "'seq' overrides" }
+#pragma acc loop seq worker // { dg-error "'seq' overrides" "TODO" { xfail *-*-* } }
     for (i = 0; i < 10; i++)
       { }
 #pragma acc loop gang worker
@@ -90,7 +90,7 @@  void K(void)
 	for (j = 1; j < 10; j++)
 	  { }
       }
-#pragma acc loop seq vector // { dg-error "'seq' overrides" }
+#pragma acc loop seq vector // { dg-error "'seq' overrides" "TODO" { xfail *-*-* } }
     for (i = 0; i < 10; i++)
       { }
 #pragma acc loop gang vector
@@ -103,7 +103,7 @@  void K(void)
 #pragma acc loop auto
     for (i = 0; i < 10; i++)
       { }
-#pragma acc loop seq auto // { dg-error "'seq' overrides" }
+#pragma acc loop seq auto // { dg-error "'seq' overrides" "TODO" { xfail *-*-* } }
     for (i = 0; i < 10; i++)
       { }
 #pragma acc loop gang auto
@@ -145,7 +145,7 @@  void K(void)
 #pragma acc kernels loop worker(num:5)
   for (i = 0; i < 10; i++)
     { }
-#pragma acc kernels loop seq worker // { dg-error "'seq' overrides" }
+#pragma acc kernels loop seq worker // { dg-error "'seq' overrides" "TODO" { xfail *-*-* } }
   for (i = 0; i < 10; i++)
     { }
 #pragma acc kernels loop gang worker
@@ -161,7 +161,7 @@  void K(void)
 #pragma acc kernels loop vector(length:5)
   for (i = 0; i < 10; i++)
     { }
-#pragma acc kernels loop seq vector // { dg-error "'seq' overrides" }
+#pragma acc kernels loop seq vector // { dg-error "'seq' overrides" "TODO" { xfail *-*-* } }
   for (i = 0; i < 10; i++)
     { }
 #pragma acc kernels loop gang vector
@@ -174,7 +174,7 @@  void K(void)
 #pragma acc kernels loop auto
   for (i = 0; i < 10; i++)
     { }
-#pragma acc kernels loop seq auto // { dg-error "'seq' overrides" }
+#pragma acc kernels loop seq auto // { dg-error "'seq' overrides" "TODO" { xfail *-*-* } }
   for (i = 0; i < 10; i++)
     { }
 #pragma acc kernels loop gang auto
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-conditional-loop-independent_seq.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-conditional-loop-independent_seq.c
new file mode 100644
index 00000000000..a81d3559daf
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-conditional-loop-independent_seq.c
@@ -0,0 +1,129 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for an OpenACC 'kernels'
+   construct containing conditionally executed 'loop' constructs with
+   'independent' or 'seq' clauses.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+extern int c;
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+  if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop seq
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent worker
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent vector
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang vector
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang worker
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent worker vector
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang worker vector
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent worker
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent vector
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+      ;
+
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop seq
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop seq
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop seq
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loop-auto.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loop-auto.c
new file mode 100644
index 00000000000..22ac5399a9d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loop-auto.c
@@ -0,0 +1,126 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for an OpenACC 'kernels'
+   construct containing 'loop' constructs with explicit or implicit 'auto'
+   clause.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels
+ /* Strangely indented to keep this similar to other test cases.  */
+ {
+#pragma acc loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto gang /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto worker /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto gang vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto gang worker /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto worker vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto gang worker vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto gang /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto worker
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto vector
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+      ;
+
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loop-independent_seq.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loop-independent_seq.c
new file mode 100644
index 00000000000..a436cd3f007
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loop-independent_seq.c
@@ -0,0 +1,126 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for an OpenACC 'kernels'
+   construct containing 'loop' constructs with 'independent' or 'seq'
+   clauses.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels
+ /* Strangely indented to keep this similar to other test cases.  */
+ {
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent worker /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent vector /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang vector /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang worker /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent worker vector /* { dg-message "note: assigned OpenACC worker vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang worker vector /* { dg-message "note: assigned OpenACC gang worker vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent gang /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent worker /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent vector /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+      ;
+
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loops.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loops.c
new file mode 100644
index 00000000000..e8b994b5be0
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-loops.c
@@ -0,0 +1,47 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for an OpenACC 'kernels'
+   construct containing loops.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ {
+  for (x = 0; x < 10; x++) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+    ;
+
+  for (x = 0; x < 10; x++)
+    ;
+
+  for (x = 0; x < 10; x++)
+    for (y = 0; y < 10; y++)
+      for (z = 0; z < 10; z++)
+	;
+
+  for (x = 0; x < 10; x++)
+    ;
+
+  for (x = 0; x < 10; x++)
+    for (y = 0; y < 10; y++)
+      ;
+
+  for (x = 0; x < 10; x++)
+    for (y = 0; y < 10; y++)
+      for (z = 0; z < 10; z++)
+	;
+
+  for (x = 0; x < 10; x++)
+    for (y = 0; y < 10; y++)
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-straight-line.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-straight-line.c
new file mode 100644
index 00000000000..8e40f6217be
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-1-kernels-straight-line.c
@@ -0,0 +1,82 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for an OpenACC 'kernels'
+   construct containing straight-line code.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+#pragma acc routine gang
+extern int
+f_g (int);
+
+#pragma acc routine worker
+extern int
+f_w (int);
+
+#pragma acc routine vector
+extern int
+f_v (int);
+
+#pragma acc routine seq
+extern int
+f_s (int);
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels /* { dg-warning "region contains gang partitoned code but is not gang partitioned" } */
+  {
+    x = 0; /* { dg-message "note: beginning .gang-single. region in OpenACC .kernels. construct" } */
+    y = x < 10;
+    z = x++;
+    ;
+
+    y = 0;
+    z = y < 10;
+    x -= f_g (y++); /* { dg-message "note: assigned OpenACC gang worker vector loop parallelism" } */
+    ;
+
+    x = f_w (0); /* { dg-message "note: assigned OpenACC worker vector loop parallelism" } */
+    z = f_v (x < 10); /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+    y -= f_s (x++); /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+    ;
+
+    x = 0;
+    y = x < 10;
+    z = (x++);
+    y = 0;
+    x = y < 10;
+    z += (y++);
+    ;
+
+    x = 0;
+    y += f_s (x < 10); /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+    x++;
+    y = 0;
+    y += f_v (y < 10); /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+    y++;
+    z = 0;
+    y += f_w (z < 10); /* { dg-message "note: assigned OpenACC worker vector loop parallelism" } */
+    z++;
+    ;
+
+    x = 0;
+    y *= f_g ( /* { dg-message "note: assigned OpenACC gang worker vector loop parallelism" } */
+	      f_w (x < 10) /* { dg-message "note: assigned OpenACC worker vector loop parallelism" } */
+	      + f_g (x < 10) /* { dg-message "note: assigned OpenACC gang worker vector loop parallelism" } */
+	      );
+    x++;
+    y = 0;
+    y *= y < 10;
+    y++;
+    z = 0;
+    y *= z < 10;
+    z++;
+    ;
+  }
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-combined-kernels-loop-auto.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-combined-kernels-loop-auto.c
new file mode 100644
index 00000000000..0254036d7af
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-combined-kernels-loop-auto.c
@@ -0,0 +1,121 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for combined OpenACC 'kernels
+   loop' constructs with explicit or implicit 'auto' clause.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto gang /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto worker /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto gang vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto gang worker /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto worker vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto gang worker vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto gang /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto worker
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto vector
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+      ;
+
+#pragma acc kernels loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop
+      for (z = 0; z < 10; z++)
+	;
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-combined-kernels-loop-independent_seq.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-combined-kernels-loop-independent_seq.c
new file mode 100644
index 00000000000..83602a9414d
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-combined-kernels-loop-independent_seq.c
@@ -0,0 +1,121 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for combined OpenACC 'kernels
+   loop' constructs with 'independent' or 'seq' clauses.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent gang /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent worker /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent vector /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent gang vector /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent gang worker /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent worker vector /* { dg-message "note: assigned OpenACC worker vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent gang worker vector /* { dg-message "note: assigned OpenACC gang worker vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent gang /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent worker /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent vector /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop independent /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+      ;
+
+#pragma acc kernels loop independent /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-conditional-loop-independent_seq.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-conditional-loop-independent_seq.c
new file mode 100644
index 00000000000..e12e0fdae52
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-conditional-loop-independent_seq.c
@@ -0,0 +1,204 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for OpenACC 'kernels'
+   constructs containing conditionally executed 'loop' constructs with
+   'independent' or 'seq' clauses.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+extern int c;
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop seq
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent gang
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent worker
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent vector
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent gang vector
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent gang worker
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent worker vector
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent gang worker vector
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent gang
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent worker
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent vector
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+      ;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop seq
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop seq
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop independent
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+ /* Strangely indented to keep this similar to other test cases.  */
+ if (c) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+ {
+#pragma acc loop seq
+  /* { dg-message "note: unparallelized loop nest in OpenACC .kernels. region: it's executed conditionally" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq
+      for (z = 0; z < 10; z++)
+	;
+ }
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loop-auto.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loop-auto.c
new file mode 100644
index 00000000000..d52b2e860c2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loop-auto.c
@@ -0,0 +1,138 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for OpenACC 'kernels'
+   constructs containing 'loop' constructs with explicit or implicit 'auto'
+   clause.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels
+#pragma acc loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto gang /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto worker /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto gang vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto gang worker /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto worker vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto gang worker vector /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto gang /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto worker
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto vector
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+      ;
+
+#pragma acc kernels
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop
+    for (y = 0; y < 10; y++)
+#pragma acc loop auto
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop auto /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop auto
+    for (y = 0; y < 10; y++)
+#pragma acc loop
+      for (z = 0; z < 10; z++)
+	;
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loop-independent_seq.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loop-independent_seq.c
new file mode 100644
index 00000000000..661f7122a2c
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loop-independent_seq.c
@@ -0,0 +1,138 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for OpenACC 'kernels'
+   constructs containing 'loop' constructs with 'independent' or 'seq'
+   clauses.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent gang /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent worker /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent vector /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent gang vector /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent gang worker /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent worker vector /* { dg-message "note: assigned OpenACC worker vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent gang worker vector /* { dg-message "note: assigned OpenACC gang worker vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent gang /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent worker /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent vector /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+    ;
+
+#pragma acc kernels
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+      ;
+
+#pragma acc kernels
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang worker loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  /* { dg-message "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } .-1 } */
+  for (x = 0; x < 10; x++)
+#pragma acc loop independent /* { dg-message "note: assigned OpenACC gang vector loop parallelism" } */
+    for (y = 0; y < 10; y++)
+#pragma acc loop seq /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+      for (z = 0; z < 10; z++)
+	;
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loops.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loops.c
new file mode 100644
index 00000000000..7587d9d2962
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism-kernels-loops.c
@@ -0,0 +1,50 @@ 
+/* Test the output of "-fopt-info-optimized-omp" for an OpenACC 'kernels'
+   construct containing loops.  */
+
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
+//TODO update accordingly
+/* See also "../../gfortran.dg/goacc/note-parallelism.f90".  */
+
+int
+main ()
+{
+  int x, y, z;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  for (x = 0; x < 10; x++) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+    ;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  for (x = 0; x < 10; x++) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+    ;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  for (x = 0; x < 10; x++) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+    for (y = 0; y < 10; y++)
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  for (x = 0; x < 10; x++) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+    ;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  for (x = 0; x < 10; x++) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+    for (y = 0; y < 10; y++)
+      ;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  for (x = 0; x < 10; x++) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+    for (y = 0; y < 10; y++)
+      for (z = 0; z < 10; z++)
+	;
+
+#pragma acc kernels /* { dg-message "note: assigned OpenACC seq loop parallelism" } */
+  for (x = 0; x < 10; x++) /* { dg-message "note: beginning .parloops. region in OpenACC .kernels. construct" } */
+    for (y = 0; y < 10; y++)
+      for (z = 0; z < 10; z++)
+	;
+
+  return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/goacc/note-parallelism.c b/gcc/testsuite/c-c++-common/goacc/note-parallelism.c
index 7548fb72d14..c514fae2574 100644
--- a/gcc/testsuite/c-c++-common/goacc/note-parallelism.c
+++ b/gcc/testsuite/c-c++-common/goacc/note-parallelism.c
@@ -1,4 +1,5 @@ 
-/* Test the output of "-fopt-info-optimized-omp".  */
+/* Test the output of "-fopt-info-optimized-omp" for OpenACC 'parallel'
+   constructs.  */
 
 /* { dg-additional-options "-fopt-info-optimized-omp" } */
 
diff --git a/gcc/testsuite/c-c++-common/goacc/routine-1.c b/gcc/testsuite/c-c++-common/goacc/routine-1.c
index 738957501b9..7cf5506e41a 100644
--- a/gcc/testsuite/c-c++-common/goacc/routine-1.c
+++ b/gcc/testsuite/c-c++-common/goacc/routine-1.c
@@ -91,7 +91,7 @@  extern void nohost (void);
 
 int main ()
 {
-#pragma acc kernels num_gangs (32) num_workers (32) vector_length (32)
+#pragma acc kernels num_gangs (32) num_workers (32) vector_length (32) /* { dg-warning "region contains gang partitoned code but is not gang partitioned" } */
   {
     gang ();
     worker ();
diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c
index 72aacd70f79..6bc35d77765 100644
--- a/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c
+++ b/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c
@@ -21,12 +21,12 @@  void acc_kernels()
 {
   int i, j, k;
 
-  #pragma acc kernels num_gangs(i) /* { dg-warning "is used uninitialized in this function" } */
+  #pragma acc kernels num_gangs(i) /* { dg-warning "is used uninitialized in this function" "TODO" { xfail *-*-* } } */
   ;
 
-  #pragma acc kernels num_workers(j) /* { dg-warning "is used uninitialized in this function" } */
+  #pragma acc kernels num_workers(j) /* { dg-warning "is used uninitialized in this function" "TODO" { xfail *-*-* } } */
   ;
 
-  #pragma acc kernels vector_length(k) /* { dg-warning "is used uninitialized in this function" } */
+  #pragma acc kernels vector_length(k) /* { dg-warning "is used uninitialized in this function" "TODO" { xfail *-*-* } } */
   ;
 }
diff --git a/gcc/testsuite/gfortran.dg/goacc/dtype-1.f95 b/gcc/testsuite/gfortran.dg/goacc/dtype-1.f95
index 460922a35df..b716d450abf 100644
--- a/gcc/testsuite/gfortran.dg/goacc/dtype-1.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/dtype-1.f95
@@ -175,13 +175,13 @@  end subroutine sr5b
 
 ! { dg-final { scan-tree-dump-times "oacc_parallel device_type\\(\\*\\) \\\[ async\\(10\\) wait\\(10\\) num_gangs\\(10\\) num_workers\\(10\\) vector_length\\(10\\) \\\] device_type\\(nvidia_ptx\\) \\\[ async\\(3\\) wait\\(3\\) num_gangs\\(300\\) num_workers\\(300\\) vector_length\\(128\\) \\\] async\\(1\\) wait\\(1\\) num_gangs\\(1\\) num_workers\\(1\\) vector_length\\(1\\)" 1 "omplower" } }
 
-! { dg-final { scan-tree-dump-times "oacc_kernels device_type\\(nvidia\\) \\\[ async\\(-1\\) wait\\(-1\\) \\\]" 1 "omplower" } }
+! { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single async\\(-1\\) num_gangs\\(1\\) device_type\\(nvidia\\) \\\[ async\\(-1\\) wait\\(-1\\) \\\]" 1 "omplower" } }
 
-! { dg-final { scan-tree-dump-times "oacc_kernels device_type\\(nvidia\\) \\\[ async\\(1\\) wait\\(1\\) \\\]" 1 "omplower" } }
+! { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single num_gangs\\(1\\) device_type\\(nvidia\\) \\\[ async\\(1\\) wait\\(1\\) \\\]" 1 "omplower" } }
 
-! { dg-final { scan-tree-dump-times "oacc_kernels device_type\\(\\*\\) \\\[ async\\(0\\) wait\\(0\\) \\\] device_type\\(nvidia\\) \\\[ async\\(2\\) wait\\(2\\) \\\]" 1 "omplower" } }
+! { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single num_gangs\\(1\\) device_type\\(\\*\\) \\\[ async\\(0\\) wait\\(0\\) \\\] device_type\\(nvidia\\) \\\[ async\\(2\\) wait\\(2\\) \\\]" 1 "omplower" } }
 
-! { dg-final { scan-tree-dump-times "oacc_kernels device_type\\(\\*\\) \\\[ async\\(0\\) wait\\(0\\) \\\] device_type\\(nvidia_ptx\\) \\\[ async\\(1\\) wait\\(1\\) \\\] async\\(-1\\) wait\\(-1\\)" 1 "omplower" } }
+! { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single num_gangs\\(1\\) device_type\\(\\*\\) \\\[ async\\(0\\) wait\\(0\\) \\\] device_type\\(nvidia_ptx\\) \\\[ async\\(1\\) wait\\(1\\) \\\] async\\(-1\\) wait\\(-1\\)" 1 "omplower" } }
 
 ! { dg-final { scan-tree-dump-times "acc loop device_type\\(nvidia\\) \\\[ tile\\(1\\) gang \\\] private\\(i1\\) private\\(i1\\.1\\)" 1 "omplower" } }
 
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-conversion.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-conversion.f95
index 6604727cf13..4672d15572e 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-conversion.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-conversion.f95
@@ -1,4 +1,3 @@ 
-! { dg-additional-options "-fopenacc-kernels=split" }
 ! { dg-additional-options "-fdump-tree-convert_oacc_kernels" }
 
 program main
@@ -50,9 +49,11 @@  end program main
 ! parallelized loop region; and three "old-style" kernel regions.
 ! { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single" 1 "convert_oacc_kernels" } }
 ! { dg-final { scan-tree-dump-times "oacc_parallel_kernels_parallelized" 1 "convert_oacc_kernels" } }
-! { dg-final { scan-tree-dump-times "oacc_kernels" 3 "convert_oacc_kernels" } }
+! { dg-final { scan-tree-dump-times "oacc_kernels " 3 "convert_oacc_kernels" } }
 
 ! Each of the parallel regions is async, and there is a final call to
 ! __builtin_GOACC_wait.
-! { dg-final { scan-tree-dump-times "oacc_parallel_kernels.* async\(-1\)" 5 "convert_oacc_kernels" } }
+! { dg-final { scan-tree-dump-times "oacc_kernels async\\(-1\\)" 3 "convert_oacc_kernels" } }
+! { dg-final { scan-tree-dump-times "oacc_parallel_kernels_gang_single async\\(-1\\)" 1 "convert_oacc_kernels" } }
+! { dg-final { scan-tree-dump-times "oacc_parallel_kernels_parallelized async\\(-1\\)" 1 "convert_oacc_kernels" } }
 ! { dg-final { scan-tree-dump-times "__builtin_GOACC_wait" 1 "convert_oacc_kernels" } }
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95
index 520bf034ac6..8173c3651e1 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-decompose-1.f95
@@ -1,6 +1,5 @@ 
 ! Test OpenACC 'kernels' construct decomposition.
 
-! { dg-additional-options "-fopenacc-kernels=split" }
 ! { dg-additional-options "-fopt-info-optimized-omp" }
 ! { dg-additional-options "-O2" } for "parloops".
 
diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95
index b83ca2d8f06..bc9bebac969 100644
--- a/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95
@@ -1,6 +1,5 @@ 
 ! { dg-do compile } 
 ! { dg-additional-options "-fdump-tree-original" } 
-! { dg-additional-options "-fopenacc-kernels=split" }
 ! { dg-additional-options "-fdump-tree-convert_oacc_kernels" }
 
 program test
diff --git a/libgomp/ChangeLog.openacc b/libgomp/ChangeLog.openacc
index 27ce3434e49..96908d1a305 100644
--- a/libgomp/ChangeLog.openacc
+++ b/libgomp/ChangeLog.openacc
@@ -1,5 +1,21 @@ 
 2019-01-31  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c:
+	Update.
+	* testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/avoid-offloading-3.c:
+	Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c:
+	Likewise.
+	* testsuite/libgomp.oacc-fortran/avoid-offloading-1.f: Likewise.
+	* testsuite/libgomp.oacc-fortran/avoid-offloading-2.f: Likewise.
+	* testsuite/libgomp.oacc-fortran/avoid-offloading-3.f: Likewise.
+	* testsuite/libgomp.oacc-fortran/initialize_kernels_loops.f90:
+	Likewise.
+
 	* testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c: New
 	file.
 
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c
index 24b5718ced6..1a5b5fbaa6d 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c
@@ -34,6 +34,7 @@  static int state = -1;
 static acc_device_t acc_device_type;
 static int acc_device_num;
 static int num_gangs, num_workers, vector_length;
+static int async;
 
 void cb_enqueue_launch_start (acc_prof_info *prof_info, acc_event_info *event_info, acc_api_info *api_info)
 {
@@ -50,7 +51,7 @@  void cb_enqueue_launch_start (acc_prof_info *prof_info, acc_event_info *event_in
   assert (prof_info->device_type == acc_device_type);
   assert (prof_info->device_number == acc_device_num);
   assert (prof_info->thread_id == -1);
-  assert (prof_info->async == acc_async_sync);
+  assert (prof_info->async == async);
   assert (prof_info->async_queue == prof_info->async);
   assert (prof_info->src_file == NULL);
   assert (prof_info->func_name == NULL);
@@ -142,8 +143,10 @@  int main()
   acc_device_num = acc_get_device_num (acc_device_type);
   assert (state == 0);
 
-  /* Parallelism dimensions: compiler/runtime decides.  */
   STATE_OP (state, = 0);
+  /* Implicit async.  */
+  async = acc_async_noval;
+  /* Parallelism dimensions: compiler/runtime decides.  */
   num_gangs = num_workers = vector_length = 0;
   {
 #define N 100
@@ -172,8 +175,10 @@  int main()
 #undef N
   }
 
-  /* Parallelism dimensions: literal.  */
   STATE_OP (state, = 0);
+  /* Explicit async: without argument.  */
+  async = acc_async_noval;
+  /* Parallelism dimensions: literal.  */
   num_gangs = 30;
   num_workers = 3;
   vector_length = 5;
@@ -181,6 +186,7 @@  int main()
 #define N 100
     int x[N];
 #pragma acc kernels \
+  async \
   num_gangs (30) num_workers (3) vector_length (5)
     /* { dg-prune-output "using vector_length \\(32\\), ignoring 5" } */
     {
@@ -206,8 +212,10 @@  int main()
 #undef N
   }
 
-  /* Parallelism dimensions: variable.  */
   STATE_OP (state, = 0);
+  /* Explicit async: variable.  */
+  async = 123;
+  /* Parallelism dimensions: variable.  */
   num_gangs = 22;
   num_workers = 5;
   vector_length = 7;
@@ -215,6 +223,7 @@  int main()
 #define N 100
     int x[N];
 #pragma acc kernels \
+  async (async) \
   num_gangs (num_gangs) num_workers (num_workers) vector_length (vector_length)
     /* { dg-prune-output "using vector_length \\(32\\), ignoring runtime setting" } */
     {
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
index 72b9ce0ce02..fb57faef054 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-1.c
@@ -1,5 +1,7 @@ 
 /* Test that the compiler decides to "avoid offloading".  */
 
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
 #include <openacc.h>
 
 int main(void)
@@ -7,8 +9,20 @@  int main(void)
   int x, y;
 
 #pragma acc data copyout(x, y)
-#pragma acc kernels /* { dg-warning "OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty" "" { target { openacc_nvidia_accel_selected && opt_levels_2_plus } } } */
-  *((volatile int *) &x) = 33, y = acc_on_device (acc_device_host);
+#pragma acc kernels
+  *((volatile int *) &x) = 33, y = acc_on_device (acc_device_host); /* { dg-warning "note: beginning .gang-single. region in OpenACC .kernels. construct" } */
+
+  /* The following will trigger "avoid offloading".  */
+#pragma acc kernels
+  {
+#pragma acc loop auto /* { dg-warning "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" } */
+    /* { dg-warning "OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty" "" { target { openacc_nvidia_accel_selected && opt_levels_2_plus } } 18 } */
+    /* { dg-warning "note: assigned OpenACC seq loop parallelism" "" { target *-*-* } 18 } */
+    for (int i = 0; i < x; ++i)
+      if (x == 0)
+	x = 1;
+      ;
+  }
 
   if (x != 33)
     __builtin_abort();
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
index 9e05d84d792..00912a3d006 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-2.c
@@ -1,6 +1,8 @@ 
 /* Test that a user can override the compiler's "avoid offloading"
    decision.  */
 
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
 #include <openacc.h>
 
 int main(void)
@@ -19,8 +21,19 @@  int main(void)
   int x, y;
 
 #pragma acc data copyout(x, y)
-#pragma acc kernels /* { dg-warning "OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty" "" { target { openacc_nvidia_accel_selected && opt_levels_2_plus } } } */
-  *((volatile int *) &x) = 33, y = acc_on_device (acc_device_host);
+#pragma acc kernels
+  *((volatile int *) &x) = 33, y = acc_on_device (acc_device_host); /* { dg-warning "note: beginning .gang-single. region in OpenACC .kernels. construct" } */
+
+  /* The following will trigger "avoid offloading".  */
+#pragma acc kernels
+  {
+#pragma acc loop auto /* { dg-warning "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" } */
+    /* { dg-warning "OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty" "" { target { openacc_nvidia_accel_selected && opt_levels_2_plus } } 30 } */
+    /* { dg-warning "note: assigned OpenACC seq loop parallelism" "" { target *-*-* } 30 } */
+    for (int i = 0; i < x; ++i)
+      if (x == 0)
+	x = 1;
+  }
 
   if (x != 33)
     __builtin_abort();
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-3.c
index f186482026e..1bb6b103b4e 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-3.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/avoid-offloading-3.c
@@ -1,6 +1,8 @@ 
 /* Test that a user can override the compiler's "avoid offloading"
    decision.  */
 
+/* { dg-additional-options "-fopt-info-optimized-omp" } */
+
 /* Override the compiler's "avoid offloading" decision.
    { dg-additional-options "-foffload-force" } */
 
@@ -12,7 +14,17 @@  int main(void)
 
 #pragma acc data copyout(x, y)
 #pragma acc kernels
-  *((volatile int *) &x) = 33, y = acc_on_device (acc_device_host);
+  *((volatile int *) &x) = 33, y = acc_on_device (acc_device_host); /* { dg-warning "note: beginning .gang-single. region in OpenACC .kernels. construct" } */
+
+  /* The following would trigger "avoid offloading".  */
+#pragma acc kernels
+  {
+#pragma acc loop auto /* { dg-warning "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" } */
+    /* { dg-warning "note: assigned OpenACC seq loop parallelism" "" { target *-*-* } 22 } */
+    for (int i = 0; i < x; ++i)
+      if (x == 0)
+	x = 1;
+  }
 
   if (x != 33)
     __builtin_abort();
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c
index 601e543495e..bf58a139d3a 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c
@@ -1,4 +1,3 @@ 
-/* { dg-additional-options "-fopenacc-kernels=split" } */
 /* { dg-additional-options "-fopt-info-optimized-omp" } */
 
 #undef NDEBUG
@@ -15,7 +14,7 @@  int main()
     int c = 234; /* { dg-warning "note: beginning .gang-single. region in OpenACC .kernels. construct" } */
 
 #pragma acc loop independent gang /* { dg-warning "note: assigned OpenACC gang loop parallelism" } */
-    /* { dg-warning "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } 17 } */
+    /* { dg-warning "note: parallelized loop nest in OpenACC .kernels. construct" "" { target *-*-* } 16 } */
     for (int i = 0; i < N; ++i)
       b[i] = c;
 
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-1.f b/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-1.f
index fb14be19d8d..275c22f90a6 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-1.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-1.f
@@ -2,6 +2,7 @@ 
 
 ! { dg-do run }
 ! { dg-additional-options "-cpp" }
+! { dg-additional-options "-fopt-info-optimized-omp" }
 ! As __OPTIMIZE__ is defined for -O1 and higher, we don't have an (easy) way to
 ! distinguish -O1 (where we will offload) from -O2 (where we won't offload), so
 ! for -O1 testing, we expect to abort.
@@ -10,16 +11,29 @@ 
       IMPLICIT NONE
       INCLUDE "openacc_lib.h"
 
+      INTEGER :: I
       INTEGER, VOLATILE :: X
       LOGICAL :: Y
 
 !$ACC DATA COPYOUT(X, Y)
-!$ACC KERNELS ! { dg-warning "OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty" "" { target { openacc_nvidia_accel_selected && opt_levels_2_plus } } }
-      X = 33
+!$ACC KERNELS
+      X = 33 ! { dg-warning "note: beginning .gang-single. region in OpenACC .kernels. construct" }
       Y = ACC_ON_DEVICE (ACC_DEVICE_HOST);
 !$ACC END KERNELS
 !$ACC END DATA
 
+      ! The following will trigger "avoid offloading".
+!$ACC KERNELS
+!$ACC LOOP AUTO ! { dg-warning "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" }
+! { dg-warning "OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty" "" { target { openacc_nvidia_accel_selected && opt_levels_2_plus } } 27 }
+! { dg-warning "note: assigned OpenACC seq loop parallelism" "" { target *-*-* } 27 }
+      DO I = 1, X
+         IF (X .EQ. 0) THEN
+            X = 1
+         END IF
+      END DO
+!$ACC END KERNELS
+
       IF (X .NE. 33) CALL ABORT
 #if defined ACC_DEVICE_TYPE_nvidia
 # if !defined __OPTIMIZE__
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-2.f b/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-2.f
index 5a064618e51..a83e1739885 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-2.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-2.f
@@ -2,11 +2,13 @@ 
 
 ! { dg-do run }
 ! { dg-additional-options "-cpp" }
+! { dg-additional-options "-fopt-info-optimized-omp" }
 
       IMPLICIT NONE
       INCLUDE "openacc_lib.h"
 
       INTEGER :: D
+      INTEGER :: I
       INTEGER, VOLATILE :: X
       LOGICAL :: Y
 
@@ -21,12 +23,24 @@ 
       CALL ACC_INIT (D)
 
 !$ACC DATA COPYOUT(X, Y)
-!$ACC KERNELS ! { dg-warning "OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty" "" { target { openacc_nvidia_accel_selected && opt_levels_2_plus } } }
-      X = 33
+!$ACC KERNELS
+      X = 33 ! { dg-warning "note: beginning .gang-single. region in OpenACC .kernels. construct" }
       Y = ACC_ON_DEVICE (ACC_DEVICE_HOST)
 !$ACC END KERNELS
 !$ACC END DATA
 
+      ! The following will trigger "avoid offloading".
+!$ACC KERNELS
+!$ACC LOOP AUTO ! { dg-warning "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" }
+! { dg-warning "OpenACC kernels construct will be executed sequentially; will by default avoid offloading to prevent data copy penalty" "" { target { openacc_nvidia_accel_selected && opt_levels_2_plus } } 34 }
+! { dg-warning "note: assigned OpenACC seq loop parallelism" "" { target *-*-* } 34 }
+      DO I = 1, X
+         IF (X .EQ. 0) THEN
+            X = 1
+         END IF
+      END DO
+!$ACC END KERNELS
+
       IF (X .NE. 33) CALL ABORT
 #if defined ACC_DEVICE_TYPE_nvidia
       IF (Y) CALL ABORT
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-3.f b/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-3.f
index 1c09f83b099..f101186ca19 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-3.f
+++ b/libgomp/testsuite/libgomp.oacc-fortran/avoid-offloading-3.f
@@ -2,6 +2,7 @@ 
 
 ! { dg-do run }
 ! { dg-additional-options "-cpp" }
+! { dg-additional-options "-fopt-info-optimized-omp" }
 !     Override the compiler's "avoid offloading" decision.
 ! { dg-additional-options "-foffload-force" }
 
@@ -9,16 +10,28 @@ 
       INCLUDE "openacc_lib.h"
 
       INTEGER :: D
+      INTEGER :: I
       INTEGER, VOLATILE :: X
       LOGICAL :: Y
 
 !$ACC DATA COPYOUT(X, Y)
 !$ACC KERNELS
-      X = 33
+      X = 33 ! { dg-warning "note: beginning .gang-single. region in OpenACC .kernels. construct" }
       Y = ACC_ON_DEVICE (ACC_DEVICE_HOST)
 !$ACC END KERNELS
 !$ACC END DATA
 
+      ! The following would trigger "avoid offloading".
+!$ACC KERNELS
+!$ACC LOOP AUTO ! { dg-warning "note: forwarded loop nest in OpenACC .kernels. construct to .parloops. for analysis" }
+! { dg-warning "note: assigned OpenACC seq loop parallelism" "" { target *-*-* } 26 }
+      DO I = 1, X
+         IF (X .EQ. 0) THEN
+            X = 1
+         END IF
+      END DO
+!$ACC END KERNELS
+
       IF (X .NE. 33) CALL ABORT
 #if defined ACC_DEVICE_TYPE_nvidia
       IF (Y) CALL ABORT
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/initialize_kernels_loops.f90 b/libgomp/testsuite/libgomp.oacc-fortran/initialize_kernels_loops.f90
index 35e909f8278..e8b4f3abc05 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/initialize_kernels_loops.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/initialize_kernels_loops.f90
@@ -1,5 +1,4 @@ 
 ! { dg-do run }
-! { dg-additional-options "-fopenacc-kernels=split" }
 ! { dg-additional-options "-fopt-info-optimized-omp" }
 
 subroutine kernel(lo, hi, a, b, c)
-- 
2.17.1