Fix sparc so that reload doesn't try to load non-trivial vector consts directly.

* config/sparc/predicates.md (input_operand): Disallow vector
	constants other than 0 and -1.
	* config/sparc/sparc.c (sparc_preferred_reload_class): Return
	NO_REGS for vector constants other than 0 and -1.

From-SVN: r180351
This commit is contained in:
David S. Miller 2011-10-23 21:51:16 +00:00 committed by David S. Miller
parent 5a53588ff0
commit 4d1a883835
3 changed files with 23 additions and 5 deletions

View File

@ -1,5 +1,10 @@
2011-10-23 David S. Miller <davem@davemloft.net>
* config/sparc/predicates.md (input_operand): Disallow vector
constants other than 0 and -1.
* config/sparc/sparc.c (sparc_preferred_reload_class): Return
NO_REGS for vector constants other than 0 and -1.
* config/sparc/sparc.h (SPARC_FIRST_INT_REG, SPARC_LAST_INT_REG,
SPARC_INT_REG_P): Define.
(HARD_REGNO_NREGS): Use SPARC_INT_REG_P.

View File

@ -427,8 +427,12 @@
&& (GET_CODE (op) == CONST_DOUBLE || GET_CODE (op) == CONST_INT))
return true;
if ((mclass == MODE_FLOAT && GET_CODE (op) == CONST_DOUBLE)
|| (mclass == MODE_VECTOR_INT && GET_CODE (op) == CONST_VECTOR))
if (mclass == MODE_FLOAT && GET_CODE (op) == CONST_DOUBLE)
return true;
if (mclass == MODE_VECTOR_INT && GET_CODE (op) == CONST_VECTOR
&& (const_zero_operand (op, mode)
|| const_all_ones_operand (op, mode)))
return true;
if (register_operand (op, mode))

View File

@ -11116,17 +11116,26 @@ sparc_conditional_register_usage (void)
static reg_class_t
sparc_preferred_reload_class (rtx x, reg_class_t rclass)
{
enum machine_mode mode = GET_MODE (x);
if (CONSTANT_P (x))
{
if (FP_REG_CLASS_P (rclass)
|| rclass == GENERAL_OR_FP_REGS
|| rclass == GENERAL_OR_EXTRA_FP_REGS
|| (GET_MODE_CLASS (GET_MODE (x)) == MODE_FLOAT && ! TARGET_FPU)
|| (GET_MODE (x) == TFmode && ! const_zero_operand (x, TFmode)))
|| (GET_MODE_CLASS (mode) == MODE_FLOAT && ! TARGET_FPU)
|| (mode == TFmode && ! const_zero_operand (x, mode)))
return NO_REGS;
if (GET_MODE_CLASS (GET_MODE (x)) == MODE_INT)
if (GET_MODE_CLASS (mode) == MODE_INT)
return GENERAL_REGS;
if (GET_MODE_CLASS (mode) == MODE_VECTOR_INT)
{
if (! FP_REG_CLASS_P (rclass)
|| !(const_zero_operand (x, mode)
|| const_all_ones_operand (x, mode)))
return NO_REGS;
}
}
return rclass;