From: kazu Date: Sat, 25 May 2002 19:47:11 +0000 (+0000) Subject: * combine.c (simplify_set): Remove an unnecessary subreg. X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=fe4ca37ce68a3edf0d3323a0bafb13fe4629b9df * combine.c (simplify_set): Remove an unnecessary subreg. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53873 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e2c29e69f8..001ff8a98f7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2002-05-25 Kazu Hirata + + * combine.c (simplify_set): Remove an unnecessary subreg. + 2002-05-25 Marek Michalkiewicz * config/avr/avr.c (avr_handle_progmem_attribute): Handle TYPE_DECL. diff --git a/gcc/combine.c b/gcc/combine.c index f3cb90f247d..e1581da1b55 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -5160,6 +5160,30 @@ simplify_set (x) src = SET_SRC (x), dest = SET_DEST (x); } +#ifdef HAVE_cc0 + /* If we have (set (cc0) (subreg ...)), we try to remove the subreg + in SRC. */ + if (dest == cc0_rtx + && GET_CODE (src) == SUBREG + && subreg_lowpart_p (src) + && (GET_MODE_BITSIZE (GET_MODE (src)) + < GET_MODE_BITSIZE (GET_MODE (SUBREG_REG (src))))) + { + rtx inner = SUBREG_REG (src); + enum machine_mode inner_mode = GET_MODE (inner); + + /* Here we make sure that we don't have a sign bit on. */ + if (GET_MODE_BITSIZE (inner_mode) <= HOST_BITS_PER_WIDE_INT + && (nonzero_bits (inner, inner_mode) + < ((unsigned HOST_WIDE_INT) 1 + << (GET_MODE_BITSIZE (inner_mode) - 1)))) + { + SUBST (SET_SRC (x), inner); + src = SET_SRC (x); + } + } +#endif + #ifdef LOAD_EXTEND_OP /* If we have (set FOO (subreg:M (mem:N BAR) 0)) with M wider than N, this would require a paradoxical subreg. Replace the subreg with a