This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: loop.c:get_condition broken


	What if the other mode is VOIDmode which I think is where the problem
	is?

Yes, we should accept VOIDmode comparisons, and allow them to be combined.

	Shouldn't the alpha be using different CCmodes to handle this problem
	in a similar manner to how several targets handle the behaviour of CC
	setting when some insns overflow?

Yes, it does now.  However, loop did not respect what CCmode means, and
was performing invalid combinations of comparisons.  The May 9 change was
an attempt to fix this.  We just need to adjust it a bit.

Here is how I suggest fixing the problem.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]