re PR middle-end/33290 (gcc.c-torture/execute/930921-1.c fails at -O1 and above now)

gcc/
	PR middle-end/33290
	* optabs.c (avoid_expensive_constant): Canonicalize CONST_INTs
	before forcing them into a register.

From-SVN: r128048
This commit is contained in:
Richard Sandiford 2007-09-03 15:35:52 +00:00 committed by Richard Sandiford
parent 171cb6996f
commit c722c7daaf
2 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2007-09-03 Richard Sandiford <richard@codesourcery.com>
PR middle-end/33290
* optabs.c (avoid_expensive_constant): Canonicalize CONST_INTs
before forcing them into a register.
2007-09-03 Richard Sandiford <richard@codesourcery.com>
* config/mips/mips.md (fetchop_bit): Use define_code_iterator

View file

@ -1290,7 +1290,13 @@ avoid_expensive_constant (enum machine_mode mode, optab binoptab,
&& CONSTANT_P (x)
&& rtx_cost (x, binoptab->code) > COSTS_N_INSNS (1))
{
if (GET_MODE (x) != VOIDmode)
if (GET_CODE (x) == CONST_INT)
{
HOST_WIDE_INT intval = trunc_int_for_mode (INTVAL (x), mode);
if (intval != INTVAL (x))
x = GEN_INT (intval);
}
else
x = convert_modes (mode, VOIDmode, x, unsignedp);
x = force_reg (mode, x);
}