]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/config/nvptx/nvptx.c
* config/nvptx/nvptx.c (nvptx_sese_number, nvptx_sese_pseudo): Don't
[thirdparty/gcc.git] / gcc / config / nvptx / nvptx.c
index 8d2740cd50fda1eb4fd5a7e06ed1a51783b490eb..c53a1ae9f26abf9d05231b9bb84753e4e9403a2f 100644 (file)
@@ -194,7 +194,7 @@ static void
 diagnose_openacc_conflict (bool optval, const char *optname)
 {
   if (flag_openacc && optval)
-    error ("option %s is not supported together with -fopenacc", optname);
+    error ("option %s is not supported together with %<-fopenacc%>", optname);
 }
 
 /* Implement TARGET_OPTION_OVERRIDE.  */
@@ -1475,7 +1475,7 @@ nvptx_output_softstack_switch (FILE *file, bool entering,
       fputs (";\n", file);
       if (!CONST_INT_P (size) || UINTVAL (align) > GET_MODE_SIZE (DImode))
        fprintf (file,
-                "\t\tand.u%d %%r%d, %%r%d, -" HOST_WIDE_INT_PRINT_DEC ";\n",
+                "\t\tand.b%d %%r%d, %%r%d, -" HOST_WIDE_INT_PRINT_DEC ";\n",
                 bits, regno, regno, UINTVAL (align));
     }
   if (cfun->machine->has_softstack)
@@ -3258,6 +3258,7 @@ nvptx_find_par (bb_insn_map_t *map, parallel *par, basic_block block)
            unsigned mask = UINTVAL (XVECEXP (PATTERN (end), 0, 0));
 
            gcc_assert (par->mask == mask);
+           gcc_assert (par->join_block == NULL);
            par->join_block = block;
            par->join_insn = end;
            if (nvptx_needs_shared_bcast (mask))
@@ -3551,7 +3552,7 @@ nvptx_sese_number (int n, int p, int dir, basic_block b,
       size_t offset = (dir > 0 ? offsetof (edge_def, dest)
                       : offsetof (edge_def, src));
       edge e;
-      edge_iterator (ei);
+      edge_iterator ei;
 
       FOR_EACH_EDGE (e, ei, edges)
        {
@@ -3574,7 +3575,7 @@ nvptx_sese_pseudo (basic_block me, bb_sese *sese, int depth, int dir,
                   vec<edge, va_gc> *edges, size_t offset)
 {
   edge e;
-  edge_iterator (ei);
+  edge_iterator ei;
   int hi_back = depth;
   pseudo_node_t node_back (0, depth);
   int hi_child = depth;
@@ -4402,8 +4403,10 @@ nvptx_single (unsigned mask, basic_block from, basic_block to)
       {
        rtx_code_label *label = gen_label_rtx ();
        rtx pred = cfun->machine->axis_predicate[mode - GOMP_DIM_WORKER];
-       rtx_insn **mode_jump = mode == GOMP_DIM_VECTOR ? &vector_jump : &worker_jump;
-       rtx_insn **mode_label = mode == GOMP_DIM_VECTOR ? &vector_label : &worker_label;
+       rtx_insn **mode_jump
+         = mode == GOMP_DIM_VECTOR ? &vector_jump : &worker_jump;
+       rtx_insn **mode_label
+         = mode == GOMP_DIM_VECTOR ? &vector_label : &worker_label;
 
        if (!pred)
          {
@@ -4437,10 +4440,7 @@ nvptx_single (unsigned mask, basic_block from, basic_block to)
              emit_insn_after (gen_exit (), label_insn);
          }
 
-       if (mode == GOMP_DIM_VECTOR)
-         vector_label = label_insn;
-       else
-         worker_label = label_insn;
+       *mode_label = label_insn;
       }
 
   /* Now deal with propagating the branch condition.  */
@@ -5577,41 +5577,6 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used)
   else
     gcc_unreachable ();
 
-  if (routine_p)
-    {
-      /* OpenACC routines in C arrive here with the following attributes
-        (omitting the 'omp declare target'):
-        seq   : __attribute__((oacc function (0 1, 0 1, 0 1)))
-        vector: __attribute__((oacc function (0 1, 0 1, 1 0)))
-        worker: __attribute__((oacc function (0 1, 1 0, 1 0)))
-        gang  : __attribute__((oacc function (1 0, 1 0, 1 0)))
-
-        If we take f.i. the oacc function attribute of the worker routine
-        (0 1, 1 0, 1 0), then:
-        - the slice (0, 1, 1) is interpreted by oacc_fn_attrib_level as
-          meaning: worker routine, that is:
-          - can't contain gang loop (0),
-          - can contain worker loop (1),
-          - can contain vector loop (1).
-        - the slice (1, 0, 0) is interpreted by oacc_validate_dims as the
-        dimensions: gang: 1, worker: 0, vector: 0.
-
-        OTOH, routines in Fortran arrive here with these attributes:
-        seq   : __attribute__((oacc function (0 0, 0 0, 0 0)))
-        vector: __attribute__((oacc function (0 0, 0 0, 1 0)))
-        worker: __attribute__((oacc function (0 0, 1 0, 1 0)))
-        gang  : __attribute__((oacc function (1 0, 1 0, 1 0)))
-        that is, the same as for C but with the dimensions set to 0.
-
-        This is due to a bug in the Fortran front-end: PR72741.  Work around
-        this bug by forcing the dimensions to be the same in Fortran as for C,
-        to be able to handle C and Fortran routines uniformly in this
-        function.  */
-      dims[GOMP_DIM_VECTOR] = fn_level > GOMP_DIM_VECTOR ? 1 : 0;
-      dims[GOMP_DIM_WORKER] = fn_level > GOMP_DIM_WORKER ? 1 : 0;
-      dims[GOMP_DIM_GANG] = fn_level > GOMP_DIM_GANG ? 1 : 0;
-    }
-
   if (oacc_min_dims_p)
     {
       gcc_assert (dims[GOMP_DIM_VECTOR] == 1);
@@ -5705,7 +5670,8 @@ nvptx_goacc_validate_dims_1 (tree decl, int dims[], int fn_level, unsigned used)
 
   if (oacc_default_dims_p)
     {
-      dims[GOMP_DIM_VECTOR] = default_vector_length;
+      if (dims[GOMP_DIM_VECTOR] < 0)
+       dims[GOMP_DIM_VECTOR] = default_vector_length;
       if (dims[GOMP_DIM_WORKER] < 0)
        dims[GOMP_DIM_WORKER] = PTX_DEFAULT_RUNTIME_DIM;
       if (dims[GOMP_DIM_GANG] < 0)
@@ -6241,7 +6207,8 @@ nvptx_goacc_reduction_init (gcall *call, offload_attrs *oa)
            init = var;
        }
 
-      gimplify_assign (lhs, init, &seq);
+      if (lhs != NULL_TREE)
+       gimplify_assign (lhs, init, &seq);
     }
 
   pop_gimplify_context (NULL);