This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
simplify_comparison fix
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com
- Date: Thu, 17 Jan 2002 15:08:40 +0100
- Subject: simplify_comparison fix
Hi,
the 20011223-1.c testcase fails, as (eq (sign_extend:SI (reg:QI)) (const_int 255))
gets simplified to (eq (reg:QI) (const_int -1)). The attached patch strengthens the
condtiion of transformation to avoid it when last bit of GET_MODE_MASK is set in the
constant operand.
Honza
Thu Jan 17 15:05:55 CET 2002 Jan Hubicka <jh@suse.cz>
* combine.c (simplify_comparison): Strengthen the condition of
sign_extension removing case.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.241.2.5
diff -c -3 -p -r1.241.2.5 combine.c
*** combine.c 2002/01/14 21:17:48 1.241.2.5
--- combine.c 2002/01/17 14:05:35
*************** simplify_comparison (code, pop0, pop1)
*** 10771,10777 ****
&& XEXP (op0, 1) == XEXP (XEXP (op0, 0), 1)
&& (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)),
MODE_INT, 1)) != BLKmode
! && ((unsigned HOST_WIDE_INT) const_op <= GET_MODE_MASK (tmode)
|| ((unsigned HOST_WIDE_INT) -const_op
<= GET_MODE_MASK (tmode))))
{
--- 10771,10777 ----
&& XEXP (op0, 1) == XEXP (XEXP (op0, 0), 1)
&& (tmode = mode_for_size (mode_width - INTVAL (XEXP (op0, 1)),
MODE_INT, 1)) != BLKmode
! && ((unsigned HOST_WIDE_INT) const_op <= (GET_MODE_MASK (tmode) >> 1)
|| ((unsigned HOST_WIDE_INT) -const_op
<= GET_MODE_MASK (tmode))))
{