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]
Other format: [Raw text]

Re: [PATCH] fold-const.c use of BRANCH_COST


	FYI, appended is the complete patch I applied.

David

	* fold-const.c (fold_range_test): Use RANGE_TEST_NON_SHORT_CIRCUIT
	macro defaulting to original BRANCH_COST heuristic.
	* doc/tm.texi (RANGE_TEST_NON_SHORT_CIRCUIT): Document.

	* config/rs6000/rs6000.h (RANGE_TEST_NON_SHORT_CIRCUIT): Define.

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.247
diff -c -p -r1.247 fold-const.c
*** fold-const.c	16 Apr 2003 21:33:19 -0000	1.247
--- fold-const.c	21 Apr 2003 18:21:19 -0000
*************** merge_ranges (pin_p, plow, phigh, in0_p,
*** 3414,3419 ****
--- 3414,3423 ----
    return 1;
  }
  
+ #ifndef RANGE_TEST_NON_SHORT_CIRCUIT
+ #define RANGE_TEST_NON_SHORT_CIRCUIT (BRANCH_COST >= 2)
+ #endif
+ 
  /* EXP is some logical combination of boolean tests.  See if we can
     merge it into some range test.  Return the new tree if so.  */
  
*************** fold_range_test (exp)
*** 3450,3456 ****
    /* On machines where the branch cost is expensive, if this is a
       short-circuited branch and the underlying object on both sides
       is the same, make a non-short-circuit operation.  */
!   else if (BRANCH_COST >= 2
  	   && lhs != 0 && rhs != 0
  	   && (TREE_CODE (exp) == TRUTH_ANDIF_EXPR
  	       || TREE_CODE (exp) == TRUTH_ORIF_EXPR)
--- 3454,3460 ----
    /* On machines where the branch cost is expensive, if this is a
       short-circuited branch and the underlying object on both sides
       is the same, make a non-short-circuit operation.  */
!   else if (RANGE_TEST_NON_SHORT_CIRCUIT
  	   && lhs != 0 && rhs != 0
  	   && (TREE_CODE (exp) == TRUTH_ANDIF_EXPR
  	       || TREE_CODE (exp) == TRUTH_ORIF_EXPR)
Index: tm.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/tm.texi,v
retrieving revision 1.214
diff -c -p -r1.214 tm.texi
*** tm.texi	20 Apr 2003 18:20:39 -0000	1.214
--- tm.texi	21 Apr 2003 18:33:01 -0000
*************** function address than to call an address
*** 5529,5534 ****
--- 5529,5540 ----
  Define this macro if it is as good or better for a function to call
  itself with an explicit address than to call an address kept in a
  register.
+ 
+ @findex RANGE_TEST_NON_SHORT_CIRCUIT
+ @item RANGE_TEST_NON_SHORT_CIRCUIT
+ Define this macro if a non-short-circuit operation produced by
+ @samp{fold_range_test ()} is optimal.  This macro defaults to true if
+ @code{BRANCH_COST} is greater than or equal to the value 2.
  @end table
  
  @deftypefn {Target Hook} bool TARGET_RTX_COSTS (rtx @var{x}, int @var{code}, int @var{outer_code}, int * at var{total})
Index: rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.267
diff -c -p -r1.267 rs6000.h
*** rs6000.h	17 Apr 2003 23:18:57 -0000	1.267
--- rs6000.h	22 Apr 2003 14:43:20 -0000
*************** extern int rs6000_default_long_calls;
*** 992,997 ****
--- 992,1001 ----
  
  #define BRANCH_COST 3
  
+ /* Override BRANCH_COST heuristic which empirically produces worse
+    performance for fold_range_test().  */
+ 
+ #define RANGE_TEST_NON_SHORT_CIRCUIT 0
  
  /* A fixed register used at prologue and epilogue generation to fix
     addressing modes.  The SPE needs heavy addressing fixes at the last


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