Commit fafaf06f by Richard Sandiford Committed by Richard Sandiford

simplify-rtx.c (simplify_subreg): Check that the inner mode is a scalar integer…

simplify-rtx.c (simplify_subreg): Check that the inner mode is a scalar integer before applying integer-only...

gcc/
	* simplify-rtx.c (simplify_subreg): Check that the inner mode is
	a scalar integer before applying integer-only optimisations to
	inner arithmetic.

From-SVN: r178848
parent 35511751
2011-09-14 Richard Sandiford <richard.sandiford@linaro.org>
* simplify-rtx.c (simplify_subreg): Check that the inner mode is
a scalar integer before applying integer-only optimisations to
inner arithmetic.
2011-09-14 Bernd Schmidt <bernds@codesourcery.com> 2011-09-14 Bernd Schmidt <bernds@codesourcery.com>
* config/mips/mips.c (mips_expand_epilogue): Generate a * config/mips/mips.c (mips_expand_epilogue): Generate a
...@@ -5611,6 +5611,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, ...@@ -5611,6 +5611,7 @@ simplify_subreg (enum machine_mode outermode, rtx op,
/* Optimize SUBREG truncations of zero and sign extended values. */ /* Optimize SUBREG truncations of zero and sign extended values. */
if ((GET_CODE (op) == ZERO_EXTEND if ((GET_CODE (op) == ZERO_EXTEND
|| GET_CODE (op) == SIGN_EXTEND) || GET_CODE (op) == SIGN_EXTEND)
&& SCALAR_INT_MODE_P (innermode)
&& GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode)) && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode))
{ {
unsigned int bitpos = subreg_lsb_1 (outermode, innermode, byte); unsigned int bitpos = subreg_lsb_1 (outermode, innermode, byte);
...@@ -5649,6 +5650,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, ...@@ -5649,6 +5650,7 @@ simplify_subreg (enum machine_mode outermode, rtx op,
if ((GET_CODE (op) == LSHIFTRT if ((GET_CODE (op) == LSHIFTRT
|| GET_CODE (op) == ASHIFTRT) || GET_CODE (op) == ASHIFTRT)
&& SCALAR_INT_MODE_P (outermode) && SCALAR_INT_MODE_P (outermode)
&& SCALAR_INT_MODE_P (innermode)
/* Ensure that OUTERMODE is at least twice as wide as the INNERMODE /* Ensure that OUTERMODE is at least twice as wide as the INNERMODE
to avoid the possibility that an outer LSHIFTRT shifts by more to avoid the possibility that an outer LSHIFTRT shifts by more
than the sign extension's sign_bit_copies and introduces zeros than the sign extension's sign_bit_copies and introduces zeros
...@@ -5668,6 +5670,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, ...@@ -5668,6 +5670,7 @@ simplify_subreg (enum machine_mode outermode, rtx op,
if ((GET_CODE (op) == LSHIFTRT if ((GET_CODE (op) == LSHIFTRT
|| GET_CODE (op) == ASHIFTRT) || GET_CODE (op) == ASHIFTRT)
&& SCALAR_INT_MODE_P (outermode) && SCALAR_INT_MODE_P (outermode)
&& SCALAR_INT_MODE_P (innermode)
&& GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode) && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode)
&& CONST_INT_P (XEXP (op, 1)) && CONST_INT_P (XEXP (op, 1))
&& GET_CODE (XEXP (op, 0)) == ZERO_EXTEND && GET_CODE (XEXP (op, 0)) == ZERO_EXTEND
...@@ -5682,6 +5685,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, ...@@ -5682,6 +5685,7 @@ simplify_subreg (enum machine_mode outermode, rtx op,
the outer subreg is effectively a truncation to the original mode. */ the outer subreg is effectively a truncation to the original mode. */
if (GET_CODE (op) == ASHIFT if (GET_CODE (op) == ASHIFT
&& SCALAR_INT_MODE_P (outermode) && SCALAR_INT_MODE_P (outermode)
&& SCALAR_INT_MODE_P (innermode)
&& GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode) && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode)
&& CONST_INT_P (XEXP (op, 1)) && CONST_INT_P (XEXP (op, 1))
&& (GET_CODE (XEXP (op, 0)) == ZERO_EXTEND && (GET_CODE (XEXP (op, 0)) == ZERO_EXTEND
...@@ -5695,7 +5699,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, ...@@ -5695,7 +5699,7 @@ simplify_subreg (enum machine_mode outermode, rtx op,
/* Recognize a word extraction from a multi-word subreg. */ /* Recognize a word extraction from a multi-word subreg. */
if ((GET_CODE (op) == LSHIFTRT if ((GET_CODE (op) == LSHIFTRT
|| GET_CODE (op) == ASHIFTRT) || GET_CODE (op) == ASHIFTRT)
&& SCALAR_INT_MODE_P (outermode) && SCALAR_INT_MODE_P (innermode)
&& GET_MODE_PRECISION (outermode) >= BITS_PER_WORD && GET_MODE_PRECISION (outermode) >= BITS_PER_WORD
&& GET_MODE_PRECISION (innermode) >= (2 * GET_MODE_PRECISION (outermode)) && GET_MODE_PRECISION (innermode) >= (2 * GET_MODE_PRECISION (outermode))
&& CONST_INT_P (XEXP (op, 1)) && CONST_INT_P (XEXP (op, 1))
...@@ -5717,6 +5721,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, ...@@ -5717,6 +5721,7 @@ simplify_subreg (enum machine_mode outermode, rtx op,
if ((GET_CODE (op) == LSHIFTRT if ((GET_CODE (op) == LSHIFTRT
|| GET_CODE (op) == ASHIFTRT) || GET_CODE (op) == ASHIFTRT)
&& SCALAR_INT_MODE_P (innermode)
&& MEM_P (XEXP (op, 0)) && MEM_P (XEXP (op, 0))
&& CONST_INT_P (XEXP (op, 1)) && CONST_INT_P (XEXP (op, 1))
&& GET_MODE_SIZE (outermode) < GET_MODE_SIZE (GET_MODE (op)) && GET_MODE_SIZE (outermode) < GET_MODE_SIZE (GET_MODE (op))
......
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