diff options
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/compare-elim.c | 22 |
2 files changed, 25 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4daecb4..c7d8eac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-04-25 Uros Bizjak <ubizjak@gmail.com> + + * compare-elim.c (try_eliminate_compare): Also handle operands with + implicit extensions. + 2012-04-25 Alan Modra <amodra@gmail.com> * config/rs6000/rs6000 (SAVE_INLINE_VRS, REST_INLINE_VRS, @@ -205,8 +210,7 @@ 2012-04-24 Jakub Jelinek <jakub@redhat.com> PR middle-end/53084 - * varasm.c (compute_reloc_for_constant): Handle ADDR_EXPR - of MEM_REF. + * varasm.c (compute_reloc_for_constant): Handle ADDR_EXPR of MEM_REF. (output_addressed_constants): Likewise. PR middle-end/52999 diff --git a/gcc/compare-elim.c b/gcc/compare-elim.c index 5157e76..f11a724 100644 --- a/gcc/compare-elim.c +++ b/gcc/compare-elim.c @@ -563,10 +563,26 @@ try_eliminate_compare (struct comparison *cmp) Validate that PREV_CLOBBER itself does in fact refer to IN_A. Do recall that we've already validated the shape of PREV_CLOBBER. */ x = XVECEXP (PATTERN (insn), 0, 0); - if (!rtx_equal_p (SET_DEST (x), in_a)) + if (rtx_equal_p (SET_DEST (x), in_a)) + cmp_src = SET_SRC (x); + + /* Also check operations with implicit extensions, e.g.: + [(set (reg:DI) + (zero_extend:DI (plus:SI (reg:SI)(reg:SI)))) + (set (reg:CCZ flags) + (compare:CCZ + (plus:SI (reg:SI)(reg:SI)) + (const_int 0)))] */ + else if (REG_P (SET_DEST (x)) + && REG_P (in_a) + && REGNO (SET_DEST (x)) == REGNO (in_a) + && (GET_CODE (SET_SRC (x)) == ZERO_EXTEND + || GET_CODE (SET_SRC (x)) == SIGN_EXTEND) + && GET_MODE (XEXP (SET_SRC (x), 0)) == GET_MODE (in_a)) + cmp_src = XEXP (SET_SRC (x), 0); + else return false; - cmp_src = SET_SRC (x); - + /* Determine if we ought to use a different CC_MODE here. */ flags = maybe_select_cc_mode (cmp, cmp_src, cmp->in_b); if (flags == NULL) |