This is the mail archive of the gcc-patches@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]

convert loop.c



Hi
This one converts canonicalize_condition to use reversed_comparison_code.
This case is little bit tricky, but should be OK
The removal of both did_reverse_condition XORs is OK, since they can be
only executed in sequence.

Bootstrapped and regression tested together with other my today patches
on i386 w/o regressions.

Honza


So led  6 21:02:16 CET 2001  Jan Hubicka  <jh@suse.cz>
	* loop.c (canonicalize_condition): Convert to use
	reversed_comparison_code.
*** /p1/gcc/loop.c	Sat Jan  6 17:04:05 2001
--- loop.c	Sat Jan  6 19:15:15 2001
*************** canonicalize_condition (insn, cond, reve
*** 8320,8327 ****
  
    if (reverse)
      {
!       code = reverse_condition (code);
!       did_reverse_condition ^= 1;
      }
  
    if (earliest)
--- 8320,8331 ----
  
    if (reverse)
      {
!       code = reversed_comparison_code (cond, insn);
!       if (code == UNKNOWN)
! 	{
! 	  code = reverse_condition (code);
! 	  did_reverse_condition ^= 1;
!         }
      }
  
    if (earliest)
*************** canonicalize_condition (insn, cond, reve
*** 8373,8385 ****
  
        if ((prev = prev_nonnote_insn (prev)) == 0
  	  || GET_CODE (prev) != INSN
! 	  || FIND_REG_INC_NOTE (prev, 0)
! 	  || (set = single_set (prev)) == 0)
  	break;
  
        /* If this is setting OP0, get what it sets it to if it looks
  	 relevant.  */
!       if (rtx_equal_p (SET_DEST (set), op0))
  	{
  	  enum machine_mode inner_mode = GET_MODE (SET_DEST (set));
  
--- 8377,8395 ----
  
        if ((prev = prev_nonnote_insn (prev)) == 0
  	  || GET_CODE (prev) != INSN
! 	  || FIND_REG_INC_NOTE (prev, 0))
! 	break;
! 
!       set = set_of (op0, prev);
! 
!       if (set
! 	  && (GET_CODE (set) != SET
! 	      || !rtx_equal_p (SET_DEST (set), op0)))
  	break;
  
        /* If this is setting OP0, get what it sets it to if it looks
  	 relevant.  */
!       if (set)
  	{
  	  enum machine_mode inner_mode = GET_MODE (SET_DEST (set));
  
*************** canonicalize_condition (insn, cond, reve
*** 8439,8448 ****
  		       || 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
- 		 have had to reverse the condition.  */
- 	      did_reverse_condition ^= 1;
  	      reverse_code = 1;
  	      x = SET_SRC (set);
  	    }
--- 8449,8454 ----
*************** canonicalize_condition (insn, cond, reve
*** 8450,8470 ****
  	    break;
  	}
  
-       else if (reg_set_p (op0, prev))
- 	/* If this sets OP0, but not directly, we have to give up.  */
- 	break;
- 
        if (x)
  	{
  	  if (GET_RTX_CLASS (GET_CODE (x)) == '<')
  	    code = GET_CODE (x);
  	  if (reverse_code)
  	    {
! 	      code = reverse_condition (code);
  	      if (code == UNKNOWN)
! 		return 0;
! 	      did_reverse_condition ^= 1;
! 	      reverse_code = 0;
  	    }
  
  	  op0 = XEXP (x, 0), op1 = XEXP (x, 1);
--- 8456,8478 ----
  	    break;
  	}
  
        if (x)
  	{
  	  if (GET_RTX_CLASS (GET_CODE (x)) == '<')
  	    code = GET_CODE (x);
  	  if (reverse_code)
  	    {
! 	      code = reversed_comparison_code (x, prev);
  	      if (code == UNKNOWN)
! 		{
! 		  /* 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
! 		     have had to reverse the condition.  */
! 		  code = reverse_condition (code);
! 		  if (code == UNKNOWN)
! 		    return 0;
! 		  reverse_code = 0;
! 		}
  	    }
  
  	  op0 = XEXP (x, 0), op1 = XEXP (x, 1);

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