[PATCH, committed] rs6000 LABEL_REF rtx_cost

David Edelsohn dje@watson.ibm.com
Wed Aug 4 23:52:00 GMT 2004


	This patch restores zero cost for LABEL_REF.  If PowerPC can
branch to the label, it's free.  This also should fix the regressions
caused by the latent bug exposed with the previous change.

David


        * config/rs6000/rs6000.c (rs6000_rtx_costs): LABEL_REFs are zero
        cost.

Index: rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.677
retrieving revision 1.678
diff -c -p -r1.677 -r1.678
*** rs6000.c	3 Aug 2004 18:23:35 -0000	1.677
--- rs6000.c	4 Aug 2004 23:38:34 -0000	1.678
*************** rs6000_rtx_costs (rtx x, int code, int o
*** 16520,16527 ****
  
    switch (code)
      {
!       /* On the RS/6000, if it is valid in the insn, it is free.
! 	 So this always returns 0.  */
      case CONST_INT:
        if (((outer_code == SET
  	    || outer_code == PLUS
--- 16520,16526 ----
  
    switch (code)
      {
!       /* On the RS/6000, if it is valid in the insn, it is free.  */
      case CONST_INT:
        if (((outer_code == SET
  	    || outer_code == PLUS
*************** rs6000_rtx_costs (rtx x, int code, int o
*** 16591,16597 ****
  
      case CONST:
      case HIGH:
-     case LABEL_REF:
      case SYMBOL_REF:
      case MEM:
        /* When optimizing for size, MEM should be slightly more expensive
--- 16590,16595 ----
*************** rs6000_rtx_costs (rtx x, int code, int o
*** 16600,16605 ****
--- 16598,16607 ----
        *total = optimize_size ? COSTS_N_INSNS (1) + 1 : COSTS_N_INSNS (2);
        return true;
  
+     case LABEL_REF:
+       *total = 0;
+       return true;
+ 
      case PLUS:
        if (mode == DFmode)
  	{



More information about the Gcc-patches mailing list