summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/nvptx/nvptx.c26
-rw-r--r--gcc/config/nvptx/nvptx.h9
-rw-r--r--gcc/config/nvptx/nvptx.md10
3 files changed, 15 insertions, 30 deletions
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index bb4c384a5d2..0fe389f2807 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -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)
diff --git a/gcc/config/nvptx/nvptx.h b/gcc/config/nvptx/nvptx.h
index ed0f28e0dd8..2015c119152 100644
--- a/gcc/config/nvptx/nvptx.h
+++ b/gcc/config/nvptx/nvptx.h
@@ -90,9 +90,12 @@
#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. */
diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index b0da63e389a..43682256e81 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -280,16 +280,6 @@
""
{
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. */