diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-27 20:54:28 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-08-27 20:54:28 +0000 |
commit | 59d15e1f5a44e31738a0e2c3d56bd918416a4fcd (patch) | |
tree | fbc1481e753d39ff76d37252ade35caddc5b102a /gcc/simplify-rtx.c | |
parent | fd42340b5fc580364b64af6adc3df2c671e5ca86 (diff) | |
download | gcc-59d15e1f5a44e31738a0e2c3d56bd918416a4fcd.tar.gz |
PR rtl-optimization/40861
* simplify-rtx.c (simplify_subreg): Do not call simplify_gen_subreg to
extract word from a multi-word subreg for negative byte positions.
testsuite/ChangeLog:
PR rtl-optimization/40861
* gcc.dg/pr40861.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151149 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index e3809a85000..0cf1dd0ce94 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -5263,13 +5263,15 @@ simplify_subreg (enum machine_mode outermode, rtx op, && GET_MODE_BITSIZE (innermode) >= (2 * GET_MODE_BITSIZE (outermode)) && CONST_INT_P (XEXP (op, 1)) && (INTVAL (XEXP (op, 1)) & (GET_MODE_BITSIZE (outermode) - 1)) == 0 + && INTVAL (XEXP (op, 1)) >= 0 && INTVAL (XEXP (op, 1)) < GET_MODE_BITSIZE (innermode) && byte == subreg_lowpart_offset (outermode, innermode)) { int shifted_bytes = INTVAL (XEXP (op, 1)) / BITS_PER_UNIT; return simplify_gen_subreg (outermode, XEXP (op, 0), innermode, (WORDS_BIG_ENDIAN - ? byte - shifted_bytes : byte + shifted_bytes)); + ? byte - shifted_bytes + : byte + shifted_bytes)); } return NULL_RTX; |