diff options
author | bonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-06 13:30:10 +0000 |
---|---|---|
committer | bonzini <bonzini@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-06 13:30:10 +0000 |
commit | 8178351ba95c3baa876a935b0b89f7c1d7bcc58a (patch) | |
tree | 9c11cd65b613a05d3ba1be634feae81966658157 /gcc/simplify-rtx.c | |
parent | 2dcae6c7bbf834e6af90253040cb30d279773e7b (diff) | |
download | gcc-8178351ba95c3baa876a935b0b89f7c1d7bcc58a.tar.gz |
2008-03-06 Paolo Bonzini <bonzini@gnu.org>
* simplify-rtx.c (simplify_subreg): Remove useless shifts from
word-extractions out of a multi-word object.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132971 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r-- | gcc/simplify-rtx.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c index 34392dce48a..44f3ef57473 100644 --- a/gcc/simplify-rtx.c +++ b/gcc/simplify-rtx.c @@ -5239,6 +5239,22 @@ simplify_subreg (enum machine_mode outermode, rtx op, return simplify_gen_binary (ASHIFT, outermode, XEXP (XEXP (op, 0), 0), XEXP (op, 1)); + /* Recognize a word extraction from a multi-word subreg. */ + if ((GET_CODE (op) == LSHIFTRT + || GET_CODE (op) == ASHIFTRT) + && SCALAR_INT_MODE_P (outermode) + && GET_MODE_BITSIZE (outermode) >= BITS_PER_WORD + && GET_MODE_BITSIZE (innermode) >= (2 * GET_MODE_BITSIZE (outermode)) + && GET_CODE (XEXP (op, 1)) == CONST_INT + && (INTVAL (XEXP (op, 1)) & (GET_MODE_BITSIZE (outermode) - 1)) == 0 + && 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)); + } + return NULL_RTX; } |