Add and use split_mode_p

2017-06-06  Tom de Vries  <tom@codesourcery.com>

	* config/nvptx/nvptx.c (split_mode_p): New function.
	(nvptx_declare_function_name, nvptx_print_operand): Use split_mode_p.

From-SVN: r248918
This commit is contained in:
Tom de Vries 2017-06-06 12:25:04 +00:00 committed by Tom de Vries
parent 02e4a6ff04
commit 38827811dd
2 changed files with 17 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2017-06-06 Tom de Vries <tom@codesourcery.com>
* config/nvptx/nvptx.c (split_mode_p): New function.
(nvptx_declare_function_name, nvptx_print_operand): Use split_mode_p.
2017-06-06 Tom de Vries <tom@codesourcery.com> 2017-06-06 Tom de Vries <tom@codesourcery.com>
* config/nvptx/nvptx.c (nvptx_print_operand): Use maybe_split_mode. * config/nvptx/nvptx.c (nvptx_print_operand): Use maybe_split_mode.

View File

@ -328,6 +328,14 @@ maybe_split_mode (machine_mode mode)
return VOIDmode; return VOIDmode;
} }
/* Return true if mode should be treated as two registers. */
static bool
split_mode_p (machine_mode mode)
{
return maybe_split_mode (mode) != VOIDmode;
}
/* Output a register, subreg, or register pair (with optional /* Output a register, subreg, or register pair (with optional
enclosing braces). */ enclosing braces). */
@ -1277,7 +1285,7 @@ nvptx_declare_function_name (FILE *file, const char *name, const_tree decl)
machine_mode mode = PSEUDO_REGNO_MODE (i); machine_mode mode = PSEUDO_REGNO_MODE (i);
machine_mode split = maybe_split_mode (mode); machine_mode split = maybe_split_mode (mode);
if (split != VOIDmode) if (split_mode_p (mode))
mode = split; mode = split;
fprintf (file, "\t.reg%s ", nvptx_ptx_type_from_mode (mode, true)); fprintf (file, "\t.reg%s ", nvptx_ptx_type_from_mode (mode, true));
output_reg (file, i, split, -2); output_reg (file, i, split, -2);
@ -2396,9 +2404,8 @@ nvptx_print_operand (FILE *file, rtx x, int code)
if (x_code == SUBREG) if (x_code == SUBREG)
{ {
mode = GET_MODE (SUBREG_REG (x)); mode = GET_MODE (SUBREG_REG (x));
machine_mode split = maybe_split_mode (mode); if (split_mode_p (mode))
if (split != VOIDmode) mode = maybe_split_mode (mode);
mode = split;
} }
fprintf (file, "%s", nvptx_ptx_type_from_mode (mode, code == 't')); fprintf (file, "%s", nvptx_ptx_type_from_mode (mode, code == 't'));
break; break;
@ -2499,7 +2506,7 @@ nvptx_print_operand (FILE *file, rtx x, int code)
machine_mode inner_mode = GET_MODE (inner_x); machine_mode inner_mode = GET_MODE (inner_x);
machine_mode split = maybe_split_mode (inner_mode); machine_mode split = maybe_split_mode (inner_mode);
if (split != VOIDmode if (split_mode_p (inner_mode)
&& (GET_MODE_SIZE (inner_mode) == GET_MODE_SIZE (mode))) && (GET_MODE_SIZE (inner_mode) == GET_MODE_SIZE (mode)))
output_reg (file, REGNO (inner_x), split); output_reg (file, REGNO (inner_x), split);
else else