* config/nvptx/nvptx.h (HARD_REGNO_NREGS): Reformat.
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Dec 2015 13:32:48 +0000 (13:32 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 15 Dec 2015 13:32:48 +0000 (13:32 +0000)
(CANNOT_CHANGE_MODE_CLASS): Always return true.
(HARD_REGNO_MODE_OK): Reformat.
* config/nvptx/nvptx.md (define_expand mov<mode>): No
RETURN_REGNUM handling here.
* config/nvptx/nvptx.c (nvptx_function_value): Set ret_reg_mode
here.
(write_one_arg): No QI or HI mode args.
(write_fn_proto_from_insn): No argument promotion here.
(nvptx_output_return_insn): No return promotion here.
(nvptx_output_mov_insn): No RETURN_REGNUM handling needed.
(nvptx_output_call_insn): No return promotion here.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231651 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/nvptx/nvptx.c
gcc/config/nvptx/nvptx.h
gcc/config/nvptx/nvptx.md

index 9b81b48..ca50fba 100644 (file)
@@ -1,3 +1,18 @@
+2015-12-15  Nathan Sidwell  <nathan@acm.org>
+
+       * config/nvptx/nvptx.h (HARD_REGNO_NREGS): Reformat.
+       (CANNOT_CHANGE_MODE_CLASS): Always return true.
+       (HARD_REGNO_MODE_OK): Reformat.
+       * config/nvptx/nvptx.md (define_expand mov<mode>): No
+       RETURN_REGNUM handling here.
+       * config/nvptx/nvptx.c (nvptx_function_value): Set ret_reg_mode
+       here.
+       (write_one_arg): No QI or HI mode args.
+       (write_fn_proto_from_insn): No argument promotion here.
+       (nvptx_output_return_insn): No return promotion here.
+       (nvptx_output_mov_insn): No RETURN_REGNUM handling needed.
+       (nvptx_output_call_insn): No return promotion here.
+
 2015-12-15  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/68851
index bb4c384..0fe389f 100644 (file)
@@ -516,7 +516,10 @@ nvptx_function_value (const_tree type, const_tree ARG_UNUSED (func),
   machine_mode mode = promote_return (TYPE_MODE (type));
 
   if (outgoing)
-    return gen_rtx_REG (mode, NVPTX_RETURN_REGNUM);
+    {
+      cfun->machine->ret_reg_mode = mode;
+      return gen_rtx_REG (mode, NVPTX_RETURN_REGNUM);
+    }
 
   return nvptx_libcall_value (mode, NULL_RTX);
 }
@@ -586,8 +589,6 @@ write_one_arg (std::stringstream &s, int for_reg, int argno, machine_mode mode)
       /* Writing PTX prototype.  */
       s << (argno ? ", " : " (");
       s << ".param" << ptx_type << " %in_ar" << argno;
-      if (mode == QImode || mode == HImode)
-       s << "[1]";
     }
   else
     {
@@ -674,6 +675,7 @@ write_return (std::stringstream &s, bool for_proto, tree type)
         this data, but more importantly for us, we must ensure it
         doesn't change the PTX prototype.  */
       mode = (machine_mode) cfun->machine->ret_reg_mode;
+
       if (mode == VOIDmode)
        return return_in_mem;
 
@@ -834,7 +836,7 @@ write_fn_proto_from_insn (std::stringstream &s, const char *name,
 
   if (result != NULL_RTX)
     s << "(.param"
-      << nvptx_ptx_type_from_mode (arg_promotion (GET_MODE (result)), false)
+      << nvptx_ptx_type_from_mode (GET_MODE (result), false)
       << " %rval) ";
 
   s << name;
@@ -1049,11 +1051,8 @@ nvptx_output_return (void)
   machine_mode mode = (machine_mode)cfun->machine->ret_reg_mode;
 
   if (mode != VOIDmode)
-    {
-      mode = arg_promotion (mode);
-      fprintf (asm_out_file, "\tst.param%s\t[%%out_retval], %%retval;\n",
-              nvptx_ptx_type_from_mode (mode, false));
-    }
+    fprintf (asm_out_file, "\tst.param%s\t[%%out_retval], %%retval;\n",
+            nvptx_ptx_type_from_mode (mode, false));
 
   return "ret;";
 }
@@ -1804,12 +1803,6 @@ nvptx_output_mov_insn (rtx dst, rtx src)
   machine_mode src_inner = (GET_CODE (src) == SUBREG
                            ? GET_MODE (XEXP (src, 0)) : dst_mode);
 
-  if (REG_P (dst) && REGNO (dst) == NVPTX_RETURN_REGNUM && dst_mode == HImode)
-    /* Special handling for the return register.  It's never really an
-       HI object, and only occurs as the destination of a move
-       insn.  */
-    dst_inner = SImode;
-
   if (src_inner == dst_inner)
     return "%.\tmov%t0\t%0, %1;";
 
@@ -1841,8 +1834,7 @@ nvptx_output_call_insn (rtx_insn *insn, rtx result, rtx callee)
   fprintf (asm_out_file, "\t{\n");
   if (result != NULL)
     fprintf (asm_out_file, "\t\t.param%s %%retval_in;\n",
-            nvptx_ptx_type_from_mode (arg_promotion (GET_MODE (result)),
-                                      false));
+            nvptx_ptx_type_from_mode (GET_MODE (result), false));
 
   /* Ensure we have a ptx declaration in the output if necessary.  */
   if (GET_CODE (callee) == SYMBOL_REF)
index ed0f28e..2015c11 100644 (file)
 #define CALL_USED_REGISTERS                            \
   { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
 
-#define HARD_REGNO_NREGS(regno, mode)  ((void)(regno), (void)(mode), 1)
-#define CANNOT_CHANGE_MODE_CLASS(M1, M2, CLS) ((CLS) == RETURN_REG)
-#define HARD_REGNO_MODE_OK(REG, MODE) nvptx_hard_regno_mode_ok (REG, MODE)
+#define HARD_REGNO_NREGS(REG, MODE)            \
+  ((void)(REG), (void)(MODE), 1)
+#define CANNOT_CHANGE_MODE_CLASS(M1, M2, CLS)  \
+  ((void)(M1), (void)(M2), (void)(CLS), true)
+#define HARD_REGNO_MODE_OK(REG, MODE)          \
+     ((void)(REG), (void)(MODE), true)
 
 /* Register Classes.  */
 
index b0da63e..4368225 100644 (file)
   ""
 {
   operands[1] = nvptx_maybe_convert_symbolic_operand (operands[1]);
-  /* Record the mode of the return register so that we can prevent
-     later optimization passes from changing it.  */
-  if (REG_P (operands[0]) && REGNO (operands[0]) == NVPTX_RETURN_REGNUM
-      && cfun)
-    {
-      if (cfun->machine->ret_reg_mode == VOIDmode)
-       cfun->machine->ret_reg_mode = GET_MODE (operands[0]);
-      else
-        gcc_assert (cfun->machine->ret_reg_mode == GET_MODE (operands[0]));
-    }
 
   /* Hard registers are often actually symbolic operands on this target.
      Don't allow them when storing to memory.  */