cse.c (fold_rtx): Use simplify_subreg.
* cse.c (fold_rtx): Use simplify_subreg. * simplify-rtx.c (simplify_replace_rtx): Use simplify_gen_subreg. (simplify_gen_subreg): New. (simplify_rtx): Use simplify_subreg. * rtl.h (simplify_gen_subreg): Declare. From-SVN: r42221
This commit is contained in:
parent
e221a0a8fb
commit
949c5d6257
|
@ -1,3 +1,12 @@
|
|||
Thu May 17 20:43:36 CEST 2001 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* cse.c (fold_rtx): Use simplify_subreg.
|
||||
|
||||
* simplify-rtx.c (simplify_replace_rtx): Use simplify_gen_subreg.
|
||||
(simplify_gen_subreg): New.
|
||||
(simplify_rtx): Use simplify_subreg.
|
||||
* rtl.h (simplify_gen_subreg): Declare.
|
||||
|
||||
2001-05-17 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* doc/install.texi: Update Solaris information.
|
||||
|
|
12
gcc/cse.c
12
gcc/cse.c
|
@ -3408,16 +3408,8 @@ fold_rtx (x, insn)
|
|||
|
||||
if (folded_arg0 != SUBREG_REG (x))
|
||||
{
|
||||
new = 0;
|
||||
|
||||
if (GET_MODE_CLASS (mode) == MODE_INT
|
||||
&& GET_MODE_SIZE (mode) == UNITS_PER_WORD
|
||||
&& GET_MODE (SUBREG_REG (x)) != VOIDmode)
|
||||
new = operand_subword (folded_arg0,
|
||||
(SUBREG_BYTE (x) / UNITS_PER_WORD), 0,
|
||||
GET_MODE (SUBREG_REG (x)));
|
||||
if (new == 0 && subreg_lowpart_p (x))
|
||||
new = gen_lowpart_if_possible (mode, folded_arg0);
|
||||
new = simplify_subreg (mode, folded_arg0,
|
||||
GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
|
||||
if (new)
|
||||
return new;
|
||||
}
|
||||
|
|
|
@ -1331,6 +1331,10 @@ extern rtx simplify_subreg PARAMS ((enum machine_mode,
|
|||
rtx,
|
||||
enum machine_mode,
|
||||
unsigned int));
|
||||
extern rtx simplify_gen_subreg PARAMS ((enum machine_mode,
|
||||
rtx,
|
||||
enum machine_mode,
|
||||
unsigned int));
|
||||
extern rtx simplify_replace_rtx PARAMS ((rtx, rtx, rtx));
|
||||
extern rtx simplify_rtx PARAMS ((rtx));
|
||||
|
||||
|
|
|
@ -259,13 +259,18 @@ simplify_replace_rtx (x, old, new)
|
|||
simplify_replace_rtx (XEXP (x, 2), old, new));
|
||||
|
||||
case 'x':
|
||||
/* The only case we try to handle is a lowpart SUBREG of a single-word
|
||||
CONST_INT. */
|
||||
if (code == SUBREG && subreg_lowpart_p (x) && old == SUBREG_REG (x)
|
||||
&& GET_CODE (new) == CONST_INT
|
||||
&& GET_MODE_SIZE (GET_MODE (old)) <= UNITS_PER_WORD)
|
||||
return GEN_INT (INTVAL (new) & GET_MODE_MASK (mode));
|
||||
|
||||
/* The only case we try to handle is a SUBREG. */
|
||||
if (code == SUBREG)
|
||||
{
|
||||
rtx exp;
|
||||
exp = simplify_gen_subreg (GET_MODE (x),
|
||||
simplify_replace_rtx (SUBREG_REG (x),
|
||||
old, new),
|
||||
GET_MODE (SUBREG_REG (x)),
|
||||
SUBREG_BYTE (x));
|
||||
if (exp)
|
||||
x = exp;
|
||||
}
|
||||
return x;
|
||||
|
||||
default:
|
||||
|
@ -2385,6 +2390,37 @@ simplify_subreg (outermode, op, innermode, byte)
|
|||
}
|
||||
return NULL_RTX;
|
||||
}
|
||||
/* Make a SUBREG operation or equivalent if it folds. */
|
||||
|
||||
rtx
|
||||
simplify_gen_subreg (outermode, op, innermode, byte)
|
||||
rtx op;
|
||||
unsigned int byte;
|
||||
enum machine_mode outermode, innermode;
|
||||
{
|
||||
rtx new;
|
||||
/* Little bit of sanity checking. */
|
||||
if (innermode == VOIDmode || outermode == VOIDmode
|
||||
|| innermode == BLKmode || outermode == BLKmode)
|
||||
abort ();
|
||||
|
||||
if (GET_MODE (op) != innermode
|
||||
&& GET_MODE (op) != VOIDmode)
|
||||
abort ();
|
||||
|
||||
if (byte % GET_MODE_SIZE (outermode)
|
||||
|| byte >= GET_MODE_SIZE (innermode))
|
||||
abort ();
|
||||
|
||||
new = simplify_subreg (outermode, op, innermode, byte);
|
||||
if (new)
|
||||
return new;
|
||||
|
||||
if (GET_CODE (op) == SUBREG || GET_MODE (op) == VOIDmode)
|
||||
return NULL_RTX;
|
||||
|
||||
return gen_rtx_SUBREG (outermode, op, byte);
|
||||
}
|
||||
/* Simplify X, an rtx expression.
|
||||
|
||||
Return the simplified expression or NULL if no simplifications
|
||||
|
@ -2454,6 +2490,13 @@ simplify_rtx (x)
|
|||
? GET_MODE (XEXP (x, 0))
|
||||
: GET_MODE (XEXP (x, 1))),
|
||||
XEXP (x, 0), XEXP (x, 1));
|
||||
case 'x':
|
||||
/* The only case we try to handle is a SUBREG. */
|
||||
if (code == SUBREG)
|
||||
return simplify_gen_subreg (mode, SUBREG_REG (x),
|
||||
GET_MODE (SUBREG_REG (x)),
|
||||
SUBREG_BYTE (x));
|
||||
return NULL;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue