[RFC] PowerPC sCC patterns

David Edelsohn dje@watson.ibm.com
Wed Nov 24 21:39:00 GMT 2004


	Here's a revised patch with which I am experimenting.

David

Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.752
diff -c -p -r1.752 rs6000.c
*** rs6000.c	24 Nov 2004 16:42:41 -0000	1.752
--- rs6000.c	24 Nov 2004 20:34:08 -0000
*************** rs6000_rtx_costs (rtx x, int code, int o
*** 18332,18357 ****
      case EQ:
      case GTU:
      case LTU:
!       if (mode == Pmode)
  	{
! 	  switch (outer_code)
  	    {
! 	    case PLUS:
! 	    case NEG:
! 	      /* PLUS or NEG already counted so only add one more.  */
! 	      *total = COSTS_N_INSNS (1);
! 	      break;
! 	    case SET:
! 	      *total = COSTS_N_INSNS (3);
! 	      break;
! 	    case COMPARE:
! 	      *total = 0;
  	      return true;
- 	    default:
- 	      break;
  	    }
  	  return false;
  	}
  
      default:
        break;
--- 18332,18369 ----
      case EQ:
      case GTU:
      case LTU:
!       /* Carry bit requires mode == Pmode.
! 	 NEG or PLUS already counted so only add one.  */
!       if (mode == Pmode
! 	  && (outer_code == NEG || outer_code == PLUS))
  	{
! 	  *total = COSTS_N_INSNS (1);
! 	  return false;
! 	}
!       if (outer_code == SET)
! 	{
! 	  if (XEXP (x, 1) == const0_rtx)
  	    {
! 	      *total = COSTS_N_INSNS (2);
  	      return true;
  	    }
+ 	  else if (mode == Pmode)
+ 	    *total = COSTS_N_INSNS (3);
+ 
  	  return false;
  	}
+       /* FALLTHRU */
+ 
+     case GT:
+     case LT:
+       if (outer_code == SET && (XEXP (x, 1) == const0_rtx))
+ 	{
+ 	  *total = COSTS_N_INSNS (2);
+ 	  return true;
+ 	}
+       if (outer_code == COMPARE)
+ 	*total = 0;
+       break;
  
      default:
        break;



More information about the Gcc-patches mailing list