Commit 4d1a8838 by David S. Miller Committed by David S. Miller

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
parent 5a53588f
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.
......@@ -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))
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment