https://gcc.gnu.org/g:04af842074d1291814c8cef98d4dcb01bf577ba6

commit 04af842074d1291814c8cef98d4dcb01bf577ba6
Author: Andrew Stubbs <[email protected]>
Date:   Tue Nov 10 09:49:53 2026 +0000

    Revert "amdgcn: Enable SIMT for OpenACC"
    
    This reverts commit 74688b45014c5197ddbaa4b0bf88918d54917845.

Diff:
---
 gcc/config/gcn/gcn-tree.cc                         | 199 +++++----------------
 gcc/config/gcn/gcn.cc                              |   5 +-
 gcc/config/gcn/gcn.md                              |  76 ++++----
 .../libgomp.c-c++-common/simt-reduction-amdgcn-1.c |  87 ---------
 .../libgomp.c-c++-common/simt-reduction-amdgcn-2.c | 107 -----------
 .../simt-reduction-amdgcn-1.c                      |  84 ---------
 .../simt-reduction-amdgcn-2.c                      | 100 -----------
 7 files changed, 89 insertions(+), 569 deletions(-)

diff --git a/gcc/config/gcn/gcn-tree.cc b/gcc/config/gcn/gcn-tree.cc
index 54044b8df081..d31b0230b3b3 100644
--- a/gcc/config/gcn/gcn-tree.cc
+++ b/gcc/config/gcn/gcn-tree.cc
@@ -443,50 +443,6 @@ gcn_reduction_update (location_t loc, gimple_stmt_iterator 
*gsi,
     return gcn_lockfull_update (loc, gsi, ptr, var, op);
 }
 
-/* OpenACC offloading function attributes.  */
-
-struct oacc_attrs
-{
-  oacc_attrs ()
-  {
-    tree attr = oacc_get_fn_attrib (current_function_decl);
-    tree dims = TREE_VALUE (attr);
-    unsigned ix;
-
-    this->mask = 0;
-
-    for (ix = 0; ix != GOMP_DIM_MAX; ix++, dims = TREE_CHAIN (dims))
-      {
-       tree t = TREE_VALUE (dims);
-       int size = (t == NULL_TREE) ? -1 : TREE_INT_CST_LOW (t);
-       tree allowed = TREE_PURPOSE (dims);
-
-       if (size != 1 && !(allowed && integer_zerop (allowed)))
-         this->mask |= GOMP_DIM_MASK (ix);
-
-       switch (ix)
-         {
-         case GOMP_DIM_GANG:
-           this->num_gangs = size;
-           break;
-
-         case GOMP_DIM_WORKER:
-           this->num_workers = size;
-           break;
-
-         case GOMP_DIM_VECTOR:
-           this->vector_length = size;
-           break;
-         }
-      }
-  }
-
-  unsigned mask;
-  int num_gangs;
-  int num_workers;
-  int vector_length;
-};
-
 /* Return a temporary variable decl to use for an OpenACC worker reduction.  */
 
 static tree
@@ -881,71 +837,16 @@ gcn_goacc_reduction_init (gcall *call)
     init = omp_reduction_init_op (gimple_location (call), rcode,
                                  TREE_TYPE (var));
 
-  if (level == GOMP_DIM_VECTOR
-      && flag_simt_mode
-      && oacc_attrs().vector_length == 64)
+  if (level == GOMP_DIM_GANG)
     {
-      /* Initialize vector-non-zeroes to INIT_VAL (OP).  */
-      tree tid = make_ssa_name (integer_type_node);
-      tree dim_vector = gimple_call_arg (call, 3);
-      gimple *tid_call = gimple_build_call_internal (IFN_GOACC_DIM_POS, 1,
-                                                    dim_vector);
-      gimple *cond_stmt = gimple_build_cond (NE_EXPR, tid, integer_zero_node,
-                                            NULL_TREE, NULL_TREE);
-
-      gimple_call_set_lhs (tid_call, tid);
-      gimple_seq_add_stmt (&seq, tid_call);
-      gimple_seq_add_stmt (&seq, cond_stmt);
-
-      /* Split the block just after the call.  */
-      edge init_edge = split_block (gsi_bb (gsi), call);
-      basic_block init_bb = init_edge->dest;
-      basic_block call_bb = init_edge->src;
-
-      /* Fixup flags from call_bb to init_bb.  */
-      init_edge->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE;
-      init_edge->probability = profile_probability::even ();
-
-      /* Set the initialization stmts.  */
-      gimple_seq init_seq = NULL;
-      tree init_var = make_ssa_name (TREE_TYPE (var));
-      gimplify_assign (init_var, init, &init_seq);
-      gsi = gsi_start_bb (init_bb);
-      gsi_insert_seq_before (&gsi, init_seq, GSI_SAME_STMT);
-
-      /* Split block just after the init stmt.  */
-      gsi_prev (&gsi);
-      edge inited_edge = split_block (gsi_bb (gsi), gsi_stmt (gsi));
-      basic_block dst_bb = inited_edge->dest;
-
-      /* Create false edge from call_bb to dst_bb.  */
-      edge nop_edge = make_edge (call_bb, dst_bb, EDGE_FALSE_VALUE);
-      nop_edge->probability = profile_probability::even ();
-
-      /* Create phi node in dst block.  */
-      gphi *phi = create_phi_node (lhs, dst_bb);
-      add_phi_arg (phi, init_var, inited_edge, gimple_location (call));
-      add_phi_arg (phi, var, nop_edge, gimple_location (call));
-
-      /* Reset dominator of dst bb.  */
-      set_immediate_dominator (CDI_DOMINATORS, dst_bb, call_bb);
-
-      /* Reset the gsi.  */
-      gsi = gsi_for_stmt (call);
+      /* If there's no receiver object, propagate the incoming VAR.  */
+      tree ref_to_res = gimple_call_arg (call, 1);
+      if (integer_zerop (ref_to_res))
+       init = var;
     }
-  else
-    {
-      if (level == GOMP_DIM_GANG)
-       {
-         /* If there's no receiver object, propagate the incoming VAR.  */
-         tree ref_to_res = gimple_call_arg (call, 1);
-         if (integer_zerop (ref_to_res))
-           init = var;
-       }
 
-      if (lhs != NULL_TREE)
-       gimplify_assign (lhs, init, &seq);
-    }
+  if (lhs)
+    gimplify_assign (lhs, init, &seq);
 
   pop_gimplify_context (NULL);
 
@@ -975,58 +876,43 @@ gcn_goacc_reduction_fini (gcall *call)
 
   push_gimplify_context (true);
 
-  if (level == GOMP_DIM_VECTOR
-      && flag_simt_mode
-      && oacc_attrs().vector_length == 64)
-    {
-      /* Implement SIMT reductions using the OpenMP code-path.  */
-      tree opcode = build_int_cst (unsigned_type_node, op);
-      gimple *call = gimple_build_call_internal (IFN_GOMP_SIMT_REDUCE, 2, var,
-                                                opcode);
-      r = make_ssa_name (TREE_TYPE (var));
-      gimple_call_set_lhs (call, r);
-      gimple_seq_add_stmt (&seq, call);
-    }
-  else
-    {
-      tree accum = NULL_TREE;
+  tree accum = NULL_TREE;
 
-      if (level == GOMP_DIM_WORKER)
+  if (level == GOMP_DIM_WORKER)
+    {
+      tree offset = gimple_call_arg (call, 5);
+      tree decl;
+      if (array_p)
        {
-         tree offset = gimple_call_arg (call, 5);
-         tree decl;
-         if (array_p)
-           {
-             tree array_type = TREE_TYPE (TREE_TYPE (array_addr));
-             decl = gcn_goacc_get_worker_array_reduction_buffer
-               (array_type, array_max_idx, &seq);
-           }
-         else
-           {
-             tree var_type = TREE_TYPE (var);
-             decl = gcn_goacc_get_worker_red_decl (var_type, offset);
-           }
-         accum = build_fold_addr_expr (decl);
+         tree array_type = TREE_TYPE (TREE_TYPE (array_addr));
+         decl = gcn_goacc_get_worker_array_reduction_buffer
+           (array_type, array_max_idx, &seq);
        }
-      else if (integer_zerop (ref_to_res))
-       r = var;
       else
-       accum = ref_to_res;
+       {
+         tree var_type = TREE_TYPE (var);
+         decl = gcn_goacc_get_worker_red_decl (var_type, offset);
+       }
+      accum = build_fold_addr_expr (decl);
+    }
+  else if (integer_zerop (ref_to_res))
+    r = var;
+  else
+    accum = ref_to_res;
 
-      if (accum)
+  if (accum)
+    {
+      /* UPDATE the accumulator.  */
+      gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
+      seq = NULL;
+      if (array_p)
        {
-         /* UPDATE the accumulator.  */
-         gsi_insert_seq_before (&gsi, seq, GSI_SAME_STMT);
-         seq = NULL;
-         if (array_p)
-           {
-             gcn_reduction_update (gimple_location (call), &gsi, accum,
-                                   array_addr, op, array_max_idx);
-             r = var;
-           }
-         else
-           r = gcn_reduction_update (gimple_location (call), &gsi, accum, var, 
op);
+         gcn_reduction_update (gimple_location (call), &gsi, accum,
+                               array_addr, op, array_max_idx);
+         r = var;
        }
+      else
+       r = gcn_reduction_update (gimple_location (call), &gsi, accum, var, op);
     }
 
   if (lhs)
@@ -1057,10 +943,7 @@ gcn_goacc_reduction_teardown (gcall *call)
 
   push_gimplify_context (true);
 
-  if (level == GOMP_DIM_WORKER
-      || (level == GOMP_DIM_VECTOR
-         && flag_simt_mode
-         && oacc_attrs().vector_length != 64))
+  if (level == GOMP_DIM_WORKER)
     {
       tree offset = gimple_call_arg (call, 5);
       if (array_p)
@@ -1154,6 +1037,12 @@ gcn_goacc_reduction (gcall *call)
 {
   int level = TREE_INT_CST_LOW (gimple_call_arg (call, 3));
 
+  if (level == GOMP_DIM_VECTOR)
+    {
+      default_goacc_reduction (call);
+      return;
+    }
+
   unsigned code = (unsigned) TREE_INT_CST_LOW (gimple_call_arg (call, 0));
 
   switch (code)
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index bf25abed321d..13f71e42e193 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -7177,10 +7177,9 @@ gcn_oacc_dim_size (int dim)
   if (dim < 0 || dim > 2)
     error ("offload dimension out of range (%d)", dim);
 
-  /* Vectors are a special case.  In SIMD mode think of this as 1 times 64.
-     In SIMT mode each lane is a separate vector position.  */
+  /* Vectors are a special case.  */
   if (dim == 2)
-    return flag_simt_mode ? GEN_INT (64) : const1_rtx;
+    return const1_rtx;         /* Think of this as 1 times 64.  */
 
   static int offset[] = {
     /* Offsets into dispatch packet.  */
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index 5b9668016792..cb7030e0efbf 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -63,6 +63,7 @@
   UNSPECV_BARRIER
   UNSPECV_ATOMIC
   UNSPECV_ICACHE_INV
+  UNSPECV_SIMT_FORK UNSPECV_SIMT_JOIN
   UNSPECV_SIMT_ENTER UNSPECV_SIMT_EXIT
   UNSPECV_SIMT_EXEC_BARRIER
   UNSPECV_SIMT_REDUCE])
@@ -2632,51 +2633,60 @@
   [(set_attr "type" "sopp")])
 
 (define_expand "oacc_fork"
-  [(match_operand:SI 0 "register_operand")
-   (match_operand:SI 1 "")
-   (match_operand:SI 2 "")]
+  [(set (match_operand:SI 0 "register_operand")
+       (unspec_volatile [(match_operand:SI 1 "")
+                         (match_operand:SI 2 "")]
+                        UNSPECV_SIMT_FORK))]
   ""
   {
-    if (flag_simt_mode)
+    /* We need to have oacc_fork/oacc_join named patterns as a pair,
+       but the fork isn't actually used.  */
+    if (!flag_simt_mode)
       {
-        int dim = INTVAL (operands[2]);
-
-       if (dim == GOMP_DIM_VECTOR)
-         emit_insn (gen_omp_simt_enter (operands[0], operands[1],
-                                        operands[2]));
-       /* Else do nothing.  */
+        gcc_unreachable ();
+       DONE;
       }
-    else
-      /* We need to have oacc_fork/oacc_join named patterns as a pair,
-        but the fork isn't actually used in SIMD mode.  */
-      gcc_unreachable ();
-
-    DONE;
   })
 
+; This pseudo instruction should be replaced by the simt_vect pass
+(define_insn "*oacc_fork_insn"
+  [(set (match_operand:SI 0 "register_operand")
+       (unspec_volatile [(match_operand:SI 1 "")
+                         (match_operand:SI 2 "")]
+                        UNSPECV_SIMT_FORK))]
+  ""
+  "; simt_fork %0 %1 %2 ")
+
 (define_expand "oacc_join"
-  [(match_operand:SI 0 "")
-   (match_operand:SI 1 "")
-   (match_operand:SI 2 "")]
+  [(unspec_volatile [(match_operand:SI 0 "")
+                    (match_operand:SI 1 "")
+                    (match_operand:SI 2 "")]
+                   UNSPECV_SIMT_JOIN)]
   ""
   {
     int dim = INTVAL (operands[2]);
-
     if (dim == GOMP_DIM_WORKER)
-      emit_insn (gen_gcn_wavefront_barrier ());
-    else if (flag_simt_mode)
       {
-       if (dim == GOMP_DIM_VECTOR)
-         emit_insn (gen_omp_simt_exit (operands[1]));
-       /* Else do nothing.  */
+        emit_insn (gen_gcn_wavefront_barrier ());
+        DONE;
       }
-    else
-      /* Other uses should not occur with SIMD mode.  */
-      gcc_unreachable ();
-
-    DONE;
+    else if (!flag_simt_mode)
+      {
+        gcc_unreachable ();
+       DONE;
+      }
+    /* else use default expansion.  */
   })
 
+; This pseudo instruction should be replaced by the simt_vect pass
+(define_insn "*oacc_join_insn"
+  [(unspec_volatile [(match_operand:SI 0 "")
+                    (match_operand:SI 1 "")
+                    (match_operand:SI 2 "")]
+                   UNSPECV_SIMT_JOIN)]
+  ""
+  "; simt_join %0 %1 %2 ")
+
 ; This pseudo instruction should be replaced by the simt_vect pass
 (define_insn "omp_simt_enter"
   [(set (match_operand 0 "register_operand" "=r")
@@ -2691,7 +2701,7 @@
 
 ; This pseudo instruction should be replaced by the simt_vect pass
 (define_insn "omp_simt_exit"
-  [(unspec_volatile [(match_operand 0 "" "")]
+  [(unspec_volatile [(match_operand 0 "register_operand" "r")]
                    UNSPECV_SIMT_EXIT)
    (set (reg:DI EXEC_REG) (const_int 1))
    (set (reg:BI EXECZ_REG) (const_int 0))]
@@ -2738,7 +2748,7 @@
        (unspec:SI [(match_operand:SI 1 "register_operand" "")]
                   UNSPEC_SIMT_VOTE_ANY))]
   "flag_simt_mode"
-  "sorry, unimplemented %0 = simt_vote_any %1")
+  "; %0 = simt_vote_any %1")
 
 ;; Implement IFN_GOMP_SIMT_LAST_LANE:
 ;; set operand 0 to the value of the last active lane
@@ -2758,7 +2768,7 @@
                 (match_operand:SI 2 "nonmemory_operand" "")]
                UNSPEC_SIMT_XCHG_IDX))]
   "flag_simt_mode"
-  "sorry, unimplemented %0 = simt_xchg_idx %1")
+  "; %0 = simt_xchg_idx %1")
 
 ;; Ensure that scalar values are visible to all lanes at the SIMT_ENTER 
 ;; transition point.  This could be a vec_duplicate, or just ensuring it's
diff --git a/libgomp/testsuite/libgomp.c-c++-common/simt-reduction-amdgcn-1.c 
b/libgomp/testsuite/libgomp.c-c++-common/simt-reduction-amdgcn-1.c
deleted file mode 100644
index 4137187fbc63..000000000000
--- a/libgomp/testsuite/libgomp.c-c++-common/simt-reduction-amdgcn-1.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Check that reductions on a "#pragma omp simd" loop nested in a
-   "#pragma omp target" region are computed correctly when GCC maps the
-   simd loop onto AMD GCN SIMT lanes (one OpenMP thread == one 64-lane
-   wavefront, see gcn-simt-vectorize.cc / gcn-simt-cbranch.cc).
-
-   Exercise both:
-     - a trip count that is an exact multiple of the 64-lane wavefront
-       width, so every SIMT group has all 64 lanes live, and
-     - a trip count that is not, so the final SIMT group is executed
-       with fewer than 64 lanes live (EXEC partially masked).  */
-
-/* { dg-do run } */
-/* { dg-require-effective-target offload_device_gcn } */
-/* { dg-additional-options "--param=offload-gpu-mode=simt" { target 
offload_target_amdgcn } } */
-
-#include <stdlib.h>
-
-#define FULL_N (64 * 5)                /* Multiple of 64: only full groups.  */
-#define PART_N (64 * 3 + 17)   /* Last group has only 17 lanes live.  */
-
-static void
-test_sum (int n)
-{
-  long sum = 0, expected = 0;
-  int i;
-
-  #pragma omp target map(tofrom: sum)
-  #pragma omp simd reduction(+:sum)
-  for (i = 0; i < n; i++)
-    sum += i;
-
-  for (i = 0; i < n; i++)
-    expected += i;
-
-  if (sum != expected)
-    abort ();
-}
-
-static void
-test_minmax (int n)
-{
-  int rmin = n, rmax = -1;
-  int i;
-
-  #pragma omp target map(tofrom: rmin, rmax)
-  #pragma omp simd reduction(min:rmin) reduction(max:rmax)
-  for (i = 0; i < n; i++)
-    {
-      if (i < rmin)
-       rmin = i;
-      if (i > rmax)
-       rmax = i;
-    }
-
-  if (rmin != 0 || rmax != n - 1)
-    abort ();
-}
-
-static void
-test_xor (int n)
-{
-  unsigned int x = 0, expected = 0;
-  int i;
-
-  #pragma omp target map(tofrom: x)
-  #pragma omp simd reduction(^:x)
-  for (i = 0; i < n; i++)
-    x ^= i;
-
-  for (i = 0; i < n; i++)
-    expected ^= i;
-
-  if (x != expected)
-    abort ();
-}
-
-int
-main (void)
-{
-  test_sum (FULL_N);
-  test_sum (PART_N);
-  test_minmax (FULL_N);
-  test_minmax (PART_N);
-  test_xor (FULL_N);
-  test_xor (PART_N);
-  return 0;
-}
diff --git a/libgomp/testsuite/libgomp.c-c++-common/simt-reduction-amdgcn-2.c 
b/libgomp/testsuite/libgomp.c-c++-common/simt-reduction-amdgcn-2.c
deleted file mode 100644
index 67acdf20df93..000000000000
--- a/libgomp/testsuite/libgomp.c-c++-common/simt-reduction-amdgcn-2.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Companion to simt-reduction-amdgcn-1.c: check reductions on a
-   "#pragma omp simd" loop nested inside team/thread parallelism
-   ("#pragma omp target teams distribute parallel for"), which is the
-   intended way to use SIMT lanes (one team's one thread == one 64-lane
-   wavefront), as opposed to the bare "target" + "simd" with no enclosing
-   teams/parallel exercised by simt-reduction-amdgcn-1.c.
-
-   num_teams(1) num_threads(1) forces a single team and a single thread,
-   i.e. a single wavefront, so this isolates the within-wavefront
-   reduction tree from any cross-team/cross-thread combination -- the
-   same thing simt-reduction-amdgcn-1.c checks, just reached through the
-   nested construct instead of the bare one.
-
-   As of this writing, this nested case does not even compile, for two
-   independent reasons, triggered regardless of the num_teams/num_threads
-   values since the limitation is structural rather than a function of
-   the actual team/thread counts:
-
-     - The GCN backend's lane-index translation for a SIMT loop inside
-       team/thread parallelism is an unimplemented stub
-       ("omp_simt_xchg_idx_<mode>" in gcn-valu.md, "sorry, placeholder
-       ... simt_xchg_idx"), hit when generating the amdgcn offload
-       image.
-
-     - Separately, generating the host fallback version of the same
-       region ICEs in expand_GOMP_SIMT_LANE (internal-fn.cc) with
-       "'--param=offload-gpu-mode=simt-directed|simt' is incompatible
-       with '-no-msimt'" -- the incompatibility is correctly diagnosed,
-       but compilation does not stop there and crashes instead.  */
-
-/* { dg-do link } */
-/* { dg-additional-options "--param=offload-gpu-mode=simt" { target 
offload_target_amdgcn } } */
-/* { dg-excess-errors "sorry, unimplemented: simt_xchg_idx; ICE in 
expand_GOMP_SIMT_LANE for the host fallback; lto1, mkoffload and lto-wrapper 
fatal errors" { target offload_target_amdgcn } } */
-
-#include <stdlib.h>
-
-#define FULL_N (64 * 5)                /* Multiple of 64: only full groups.  */
-#define PART_N (64 * 3 + 17)   /* Last group has only 17 lanes live.  */
-
-static void
-test_sum (int n)
-{
-  long sum = 0, expected = 0;
-  int i;
-
-  #pragma omp target teams distribute parallel for simd \
-    num_teams(1) num_threads(1) reduction(+:sum) map(tofrom: sum)
-  for (i = 0; i < n; i++)
-    sum += i;
-
-  for (i = 0; i < n; i++)
-    expected += i;
-
-  if (sum != expected)
-    abort ();
-}
-
-static void
-test_minmax (int n)
-{
-  int rmin = n, rmax = -1;
-  int i;
-
-  #pragma omp target teams distribute parallel for simd \
-    num_teams(1) num_threads(1) \
-    reduction(min:rmin) reduction(max:rmax) map(tofrom: rmin, rmax)
-  for (i = 0; i < n; i++)
-    {
-      if (i < rmin)
-       rmin = i;
-      if (i > rmax)
-       rmax = i;
-    }
-
-  if (rmin != 0 || rmax != n - 1)
-    abort ();
-}
-
-static void
-test_xor (int n)
-{
-  unsigned int x = 0, expected = 0;
-  int i;
-
-  #pragma omp target teams distribute parallel for simd \
-    num_teams(1) num_threads(1) reduction(^:x) map(tofrom: x)
-  for (i = 0; i < n; i++)
-    x ^= i;
-
-  for (i = 0; i < n; i++)
-    expected ^= i;
-
-  if (x != expected)
-    abort ();
-}
-
-int
-main (void)
-{
-  test_sum (FULL_N);
-  test_sum (PART_N);
-  test_minmax (FULL_N);
-  test_minmax (PART_N);
-  test_xor (FULL_N);
-  test_xor (PART_N);
-  return 0;
-}
diff --git 
a/libgomp/testsuite/libgomp.oacc-c-c++-common/simt-reduction-amdgcn-1.c 
b/libgomp/testsuite/libgomp.oacc-c-c++-common/simt-reduction-amdgcn-1.c
deleted file mode 100644
index e8e9fad9f902..000000000000
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/simt-reduction-amdgcn-1.c
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Check that reductions on a "#pragma acc loop vector" nested in a
-   "#pragma acc parallel" region are computed correctly on AMD GCN, where
-   the vector dimension is mapped onto the 64 SIMT lanes of a wavefront.
-
-   Exercise both:
-     - a trip count that is an exact multiple of the 64-lane wavefront
-       width, so every SIMT group has all 64 lanes live, and
-     - a trip count that is not, so the final SIMT group is executed
-       with fewer than 64 lanes live (EXEC partially masked).  */
-
-/* { dg-do run { target openacc_radeon_accel_selected } } */
-
-#include <stdlib.h>
-
-#define FULL_N (64 * 5)                /* Multiple of 64: only full groups.  */
-#define PART_N (64 * 3 + 17)   /* Last group has only 17 lanes live.  */
-
-static void
-test_sum (int n)
-{
-  long sum = 0, expected = 0;
-  int i;
-
-  #pragma acc parallel copy(sum)
-  #pragma acc loop vector reduction(+:sum)
-  for (i = 0; i < n; i++)
-    sum += i;
-
-  for (i = 0; i < n; i++)
-    expected += i;
-
-  if (sum != expected)
-    abort ();
-}
-
-static void
-test_minmax (int n)
-{
-  int rmin = n, rmax = -1;
-  int i;
-
-  #pragma acc parallel copy(rmin, rmax)
-  #pragma acc loop vector reduction(min:rmin) reduction(max:rmax)
-  for (i = 0; i < n; i++)
-    {
-      if (i < rmin)
-       rmin = i;
-      if (i > rmax)
-       rmax = i;
-    }
-
-  if (rmin != 0 || rmax != n - 1)
-    abort ();
-}
-
-static void
-test_xor (int n)
-{
-  unsigned int x = 0, expected = 0;
-  int i;
-
-  #pragma acc parallel copy(x)
-  #pragma acc loop vector reduction(^:x)
-  for (i = 0; i < n; i++)
-    x ^= i;
-
-  for (i = 0; i < n; i++)
-    expected ^= i;
-
-  if (x != expected)
-    abort ();
-}
-
-int
-main (void)
-{
-  test_sum (FULL_N);
-  test_sum (PART_N);
-  test_minmax (FULL_N);
-  test_minmax (PART_N);
-  test_xor (FULL_N);
-  test_xor (PART_N);
-  return 0;
-}
diff --git 
a/libgomp/testsuite/libgomp.oacc-c-c++-common/simt-reduction-amdgcn-2.c 
b/libgomp/testsuite/libgomp.oacc-c-c++-common/simt-reduction-amdgcn-2.c
deleted file mode 100644
index b59fa9f94011..000000000000
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/simt-reduction-amdgcn-2.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Companion to simt-reduction-amdgcn-1.c: check reductions on a
-   "#pragma acc loop vector" nested inside gang/worker parallelism
-   ("#pragma acc parallel" + "#pragma acc loop worker"), which is the
-   OpenACC analogue of simt-reduction-amdgcn-2.c's OpenMP
-   "teams distribute parallel for simd" case, as opposed to the bare
-   "#pragma acc parallel" + "#pragma acc loop vector" with no enclosing
-   worker loop exercised by simt-reduction-amdgcn-1.c.
-
-   num_gangs(1) num_workers(1) forces a single gang and a single worker,
-   i.e. a single wavefront, so this isolates the within-wavefront
-   reduction tree from any cross-gang/cross-worker combination -- the
-   same thing simt-reduction-amdgcn-1.c checks, just reached through the
-   nested construct instead of the bare one.  */
-
-/* { dg-do run { target openacc_radeon_accel_selected } } */
-
-#include <stdlib.h>
-
-#define FULL_N (64 * 5)                /* Multiple of 64: only full groups.  */
-#define PART_N (64 * 3 + 17)   /* Last group has only 17 lanes live.  */
-
-static void
-test_sum (int n)
-{
-  long sum = 0, expected = 0;
-  int i;
-
-  #pragma acc parallel num_gangs(1) num_workers(1) copy(sum)
-  #pragma acc loop worker
-  for (int w = 0; w < 1; w++)
-    {
-      #pragma acc loop vector reduction(+:sum)
-      for (i = 0; i < n; i++)
-       sum += i;
-    }
-
-  for (i = 0; i < n; i++)
-    expected += i;
-
-  if (sum != expected)
-    abort ();
-}
-
-static void
-test_minmax (int n)
-{
-  int rmin = n, rmax = -1;
-  int i;
-
-  #pragma acc parallel num_gangs(1) num_workers(1) copy(rmin, rmax)
-  #pragma acc loop worker
-  for (int w = 0; w < 1; w++)
-    {
-      #pragma acc loop vector reduction(min:rmin) reduction(max:rmax)
-      for (i = 0; i < n; i++)
-       {
-         if (i < rmin)
-           rmin = i;
-         if (i > rmax)
-           rmax = i;
-       }
-    }
-
-  if (rmin != 0 || rmax != n - 1)
-    abort ();
-}
-
-static void
-test_xor (int n)
-{
-  unsigned int x = 0, expected = 0;
-  int i;
-
-  #pragma acc parallel num_gangs(1) num_workers(1) copy(x)
-  #pragma acc loop worker
-  for (int w = 0; w < 1; w++)
-    {
-      #pragma acc loop vector reduction(^:x)
-      for (i = 0; i < n; i++)
-       x ^= i;
-    }
-
-  for (i = 0; i < n; i++)
-    expected ^= i;
-
-  if (x != expected)
-    abort ();
-}
-
-int
-main (void)
-{
-  test_sum (FULL_N);
-  test_sum (PART_N);
-  test_minmax (FULL_N);
-  test_minmax (PART_N);
-  test_xor (FULL_N);
-  test_xor (PART_N);
-  return 0;
-}

Reply via email to