Commit 3343cf6a by Richard Sandiford Committed by Richard Sandiford

re PR target/60604 (GCC incorrectly compiles s_csinh function on MIPS32 (32bit fp))

gcc/
	PR rtl-optimization/60604
	* recog.c (general_operand): Incorporate REG_CANNOT_CHANGE_MODE_P
	check from register_operand.
	(register_operand): Redefine in terms of general_operand.
	(nonmemory_operand): Use register_operand for the non-constant cases.

From-SVN: r208984
parent fb0aab23
2014-04-01 Richard Sandiford <rdsandiford@googlemail.com>
PR rtl-optimization/60604
* recog.c (general_operand): Incorporate REG_CANNOT_CHANGE_MODE_P
check from register_operand.
(register_operand): Redefine in terms of general_operand.
(nonmemory_operand): Use register_operand for the non-constant cases.
2014-04-01 Richard Biener <rguenther@suse.de> 2014-04-01 Richard Biener <rguenther@suse.de>
* gimple.h (struct gimple_statement_base): Align subcode to * gimple.h (struct gimple_statement_base): Align subcode to
......
...@@ -1023,6 +1023,19 @@ general_operand (rtx op, enum machine_mode mode) ...@@ -1023,6 +1023,19 @@ general_operand (rtx op, enum machine_mode mode)
&& MEM_P (sub)) && MEM_P (sub))
return 0; return 0;
#ifdef CANNOT_CHANGE_MODE_CLASS
if (REG_P (sub)
&& REGNO (sub) < FIRST_PSEUDO_REGISTER
&& REG_CANNOT_CHANGE_MODE_P (REGNO (sub), GET_MODE (sub), mode)
&& GET_MODE_CLASS (GET_MODE (sub)) != MODE_COMPLEX_INT
&& GET_MODE_CLASS (GET_MODE (sub)) != MODE_COMPLEX_FLOAT
/* LRA can generate some invalid SUBREGS just for matched
operand reload presentation. LRA needs to treat them as
valid. */
&& ! LRA_SUBREG_P (op))
return 0;
#endif
/* FLOAT_MODE subregs can't be paradoxical. Combine will occasionally /* FLOAT_MODE subregs can't be paradoxical. Combine will occasionally
create such rtl, and we must reject it. */ create such rtl, and we must reject it. */
if (SCALAR_FLOAT_MODE_P (GET_MODE (op)) if (SCALAR_FLOAT_MODE_P (GET_MODE (op))
...@@ -1083,9 +1096,6 @@ address_operand (rtx op, enum machine_mode mode) ...@@ -1083,9 +1096,6 @@ address_operand (rtx op, enum machine_mode mode)
int int
register_operand (rtx op, enum machine_mode mode) register_operand (rtx op, enum machine_mode mode)
{ {
if (GET_MODE (op) != mode && mode != VOIDmode)
return 0;
if (GET_CODE (op) == SUBREG) if (GET_CODE (op) == SUBREG)
{ {
rtx sub = SUBREG_REG (op); rtx sub = SUBREG_REG (op);
...@@ -1096,41 +1106,12 @@ register_operand (rtx op, enum machine_mode mode) ...@@ -1096,41 +1106,12 @@ register_operand (rtx op, enum machine_mode mode)
(Ideally, (SUBREG (MEM)...) should not exist after reload, (Ideally, (SUBREG (MEM)...) should not exist after reload,
but currently it does result from (SUBREG (REG)...) where the but currently it does result from (SUBREG (REG)...) where the
reg went on the stack.) */ reg went on the stack.) */
if (! reload_completed && MEM_P (sub)) if (!REG_P (sub) && (reload_completed || !MEM_P (sub)))
return general_operand (op, mode);
#ifdef CANNOT_CHANGE_MODE_CLASS
if (REG_P (sub)
&& REGNO (sub) < FIRST_PSEUDO_REGISTER
&& REG_CANNOT_CHANGE_MODE_P (REGNO (sub), GET_MODE (sub), mode)
&& GET_MODE_CLASS (GET_MODE (sub)) != MODE_COMPLEX_INT
&& GET_MODE_CLASS (GET_MODE (sub)) != MODE_COMPLEX_FLOAT
/* LRA can generate some invalid SUBREGS just for matched
operand reload presentation. LRA needs to treat them as
valid. */
&& ! LRA_SUBREG_P (op))
return 0;
#endif
/* FLOAT_MODE subregs can't be paradoxical. Combine will occasionally
create such rtl, and we must reject it. */
if (SCALAR_FLOAT_MODE_P (GET_MODE (op))
/* LRA can use subreg to store a floating point value in an
integer mode. Although the floating point and the
integer modes need the same number of hard registers, the
size of floating point mode can be less than the integer
mode. */
&& ! lra_in_progress
&& GET_MODE_SIZE (GET_MODE (op)) > GET_MODE_SIZE (GET_MODE (sub)))
return 0; return 0;
op = sub;
} }
else if (!REG_P (op))
return (REG_P (op) return 0;
&& (REGNO (op) >= FIRST_PSEUDO_REGISTER return general_operand (op, mode);
|| in_hard_reg_set_p (operand_reg_set,
GET_MODE (op), REGNO (op))));
} }
/* Return 1 for a register in Pmode; ignore the tested mode. */ /* Return 1 for a register in Pmode; ignore the tested mode. */
...@@ -1232,27 +1213,7 @@ nonmemory_operand (rtx op, enum machine_mode mode) ...@@ -1232,27 +1213,7 @@ nonmemory_operand (rtx op, enum machine_mode mode)
{ {
if (CONSTANT_P (op)) if (CONSTANT_P (op))
return immediate_operand (op, mode); return immediate_operand (op, mode);
return register_operand (op, mode);
if (GET_MODE (op) != mode && mode != VOIDmode)
return 0;
if (GET_CODE (op) == SUBREG)
{
/* Before reload, we can allow (SUBREG (MEM...)) as a register operand
because it is guaranteed to be reloaded into one.
Just make sure the MEM is valid in itself.
(Ideally, (SUBREG (MEM)...) should not exist after reload,
but currently it does result from (SUBREG (REG)...) where the
reg went on the stack.) */
if (! reload_completed && MEM_P (SUBREG_REG (op)))
return general_operand (op, mode);
op = SUBREG_REG (op);
}
return (REG_P (op)
&& (REGNO (op) >= FIRST_PSEUDO_REGISTER
|| in_hard_reg_set_p (operand_reg_set,
GET_MODE (op), REGNO (op))));
} }
/* Return 1 if OP is a valid operand that stands for pushing a /* Return 1 if OP is a valid operand that stands for pushing a
......
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