This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: loop.c:get_condition broken
- To: egcs-patches at cygnus dot com
- Subject: Re: loop.c:get_condition broken
- From: Jim Wilson <wilson at cygnus dot com>
- Date: Thu, 08 Oct 1998 12:52:54 -0700
I checked in this patch to fix the loop optimization problems reported
by David Edelsohn and Michael Hayes on the egcs list.
Wed Oct 7 15:37:33 1998 Jim Wilson <wilson@cygnus.com>
* loop.c (get_condition): Allow combine when either compare is
VOIDmode.
Index: loop.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/loop.c,v
retrieving revision 1.80
diff -p -r1.80 loop.c
*** loop.c 1998/09/30 17:32:15 1.80
--- loop.c 1998/10/07 22:37:13
*************** get_condition (jump, earliest)
*** 7830,7837 ****
like Alpha that have an IEEE compliant EQ instruction, and
a non-IEEE compliant BEQ instruction. The use of CCmode is
actually artificial, simply to prevent the combination, but
! should not affect other platforms. */
if ((GET_CODE (SET_SRC (set)) == COMPARE
|| (((code == NE
|| (code == LT
--- 7830,7844 ----
like Alpha that have an IEEE compliant EQ instruction, and
a non-IEEE compliant BEQ instruction. The use of CCmode is
actually artificial, simply to prevent the combination, but
! should not affect other platforms.
+ However, we must allow VOIDmode comparisons to match either
+ CCmode or non-CCmode comparison, because some ports have
+ modeless comparisons inside branch patterns.
+
+ ??? This mode check should perhaps look more like the mode check
+ in simplify_comparison in combine. */
+
if ((GET_CODE (SET_SRC (set)) == COMPARE
|| (((code == NE
|| (code == LT
*************** get_condition (jump, earliest)
*** 7848,7855 ****
#endif
))
&& GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == '<'))
! && ((GET_MODE_CLASS (mode) == MODE_CC)
! == (GET_MODE_CLASS (inner_mode) == MODE_CC)))
x = SET_SRC (set);
else if (((code == EQ
|| (code == GE
--- 7855,7863 ----
#endif
))
&& GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == '<'))
! && (((GET_MODE_CLASS (mode) == MODE_CC)
! == (GET_MODE_CLASS (inner_mode) == MODE_CC))
! || mode == VOIDmode || inner_mode == VOIDmode))
x = SET_SRC (set);
else if (((code == EQ
|| (code == GE
*************** get_condition (jump, earliest)
*** 7866,7873 ****
#endif
))
&& GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == '<'
! && ((GET_MODE_CLASS (mode) == MODE_CC)
! == (GET_MODE_CLASS (inner_mode) == MODE_CC)))
{
/* We might have reversed a LT to get a GE here. But this wasn't
actually the comparison of data, so we don't flag that we
--- 7874,7883 ----
#endif
))
&& GET_RTX_CLASS (GET_CODE (SET_SRC (set))) == '<'
! && (((GET_MODE_CLASS (mode) == MODE_CC)
! == (GET_MODE_CLASS (inner_mode) == MODE_CC))
! || mode == VOIDmode || inner_mode == VOIDmode))
!
{
/* We might have reversed a LT to get a GE here. But this wasn't
actually the comparison of data, so we don't flag that we