This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH,redo - fight wraps] combine: fix incorrect optimizations for ints larger that HOST_WIDE_INT
- From: Igor Shevlyakov <igor at microunity dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 12 Sep 2002 15:34:44 -0700
- Subject: [PATCH,redo - fight wraps] combine: fix incorrect optimizations for ints larger that HOST_WIDE_INT
In simplify_set there is a call to force_to_mode which suppose to simplify source of the set.
The call is supplied with bit mask in bits actually used in source. When size of integer type
(in my case it's 128) is larger than HOST_WIND_INT that bit mask couldn't describe used
bits propery. So force_to_mode shouldn't be called in this case.
======= ChangeLog entry =======
2002-09-12 Igor Shevlyakov <igor@microunity.com>
* combine.c (simplify_set): Don't call to force_to_mode if size of integer type is
larger than HOST_BITS_PER_WIDE_INT since used bits couldn't be represented
properly.
======= patch ===============
Index: combine.c ===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/combine.c,v
retrieving revision 1.313
diff -c -3 -p -r1.313 combine.c
*** combine.c 8 Sep 2002 18:07:54 -0000 1.313
--- combine.c 12 Sep 2002 22:21:06 -0000
*************** simplify_set (x)
*** 5005,5011 ****
simplify the expression for the object knowing that we only need the
low-order bits. */
! if (GET_MODE_CLASS (mode) == MODE_INT)
{
src = force_to_mode (src, mode, ~(HOST_WIDE_INT) 0, NULL_RTX, 0);
SUBST (SET_SRC (x), src);
--- 5005,5012 ----
simplify the expression for the object knowing that we only need the
low-order bits. */
! if ((GET_MODE_CLASS (mode) == MODE_INT) &&
! (GET_MODE_BITSIZE(mode) <= HOST_BITS_PER_WIDE_INT))
{
src = force_to_mode (src, mode, ~(HOST_WIDE_INT) 0, NULL_RTX, 0);
SUBST (SET_SRC (x), src);