From: rsandifo Date: Wed, 14 Sep 2011 12:17:03 +0000 (+0000) Subject: gcc/ X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=23068d35a2a2f6d22033ee187883634692ab195a gcc/ * simplify-rtx.c (simplify_subreg): Check that the inner mode is a scalar integer before applying integer-only optimisations to inner arithmetic. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178848 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7de4c651ecb..941abc4cdaa 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-09-14 Richard Sandiford + + * 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 * config/mips/mips.c (mips_expand_epilogue): Generate a diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index ef5ea1aac33..d81e3a6282c 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -5611,6 +5611,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, /* Optimize SUBREG truncations of zero and sign extended values. */ if ((GET_CODE (op) == ZERO_EXTEND || GET_CODE (op) == SIGN_EXTEND) + && SCALAR_INT_MODE_P (innermode) && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode)) { unsigned int bitpos = subreg_lsb_1 (outermode, innermode, byte); @@ -5649,6 +5650,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, if ((GET_CODE (op) == LSHIFTRT || GET_CODE (op) == ASHIFTRT) && SCALAR_INT_MODE_P (outermode) + && SCALAR_INT_MODE_P (innermode) /* Ensure that OUTERMODE is at least twice as wide as the INNERMODE to avoid the possibility that an outer LSHIFTRT shifts by more than the sign extension's sign_bit_copies and introduces zeros @@ -5668,6 +5670,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, if ((GET_CODE (op) == LSHIFTRT || GET_CODE (op) == ASHIFTRT) && SCALAR_INT_MODE_P (outermode) + && SCALAR_INT_MODE_P (innermode) && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode) && CONST_INT_P (XEXP (op, 1)) && GET_CODE (XEXP (op, 0)) == ZERO_EXTEND @@ -5682,6 +5685,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, the outer subreg is effectively a truncation to the original mode. */ if (GET_CODE (op) == ASHIFT && SCALAR_INT_MODE_P (outermode) + && SCALAR_INT_MODE_P (innermode) && GET_MODE_PRECISION (outermode) < GET_MODE_PRECISION (innermode) && CONST_INT_P (XEXP (op, 1)) && (GET_CODE (XEXP (op, 0)) == ZERO_EXTEND @@ -5695,7 +5699,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, /* Recognize a word extraction from a multi-word subreg. */ if ((GET_CODE (op) == LSHIFTRT || GET_CODE (op) == ASHIFTRT) - && SCALAR_INT_MODE_P (outermode) + && SCALAR_INT_MODE_P (innermode) && GET_MODE_PRECISION (outermode) >= BITS_PER_WORD && GET_MODE_PRECISION (innermode) >= (2 * GET_MODE_PRECISION (outermode)) && CONST_INT_P (XEXP (op, 1)) @@ -5717,6 +5721,7 @@ simplify_subreg (enum machine_mode outermode, rtx op, if ((GET_CODE (op) == LSHIFTRT || GET_CODE (op) == ASHIFTRT) + && SCALAR_INT_MODE_P (innermode) && MEM_P (XEXP (op, 0)) && CONST_INT_P (XEXP (op, 1)) && GET_MODE_SIZE (outermode) < GET_MODE_SIZE (GET_MODE (op))