This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: target/17107: Fix
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, David Edelsohn <dje at watson dot ibm dot com>
- Date: Thu, 18 Nov 2004 12:07:41 +0000
- Subject: Re: target/17107: Fix
- Organization: Codesourcery LLC
- References: <Pine.LNX.4.44.0411171925350.16819-100000@www.eyesopen.com>
Roger Sayle wrote:
With the above tweak, your change to fold_truthop actually becomes a
one-liner, i.e. "+ if (BLAH)". I hope you don't strongly disagree?
sure, this is what I've checked in.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
2004-11-18 Nathan Sidwell <nathan@codesourcery.com>
PR target/17107
* fold-const.c (RANGE_TEST_NON_SHORT_CIRCUIT): Rename to ...
(LOGICAL_OP_NON_SHORT_CIRCUIT): ... here.
(fold_range_test): Adjust.
(fold_truthop): Use it.
* config/rs6000/rs6000.h (RANGE_TEST_NON_SHORT_CIRCUIT): Rename to ...
(LOGICAL_OP_NON_SHORT_CIRCUIT): ... here.
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.474
diff -c -3 -p -r1.474 fold-const.c
*** fold-const.c 15 Nov 2004 00:18:32 -0000 1.474
--- fold-const.c 18 Nov 2004 12:00:57 -0000
*************** fold_cond_expr_with_comparison (tree typ
*** 4392,4399 ****
! #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
--- 4392,4399 ----
! #ifndef LOGICAL_OP_NON_SHORT_CIRCUIT
! #define LOGICAL_OP_NON_SHORT_CIRCUIT (BRANCH_COST >= 2)
#endif
/* EXP is some logical combination of boolean tests. See if we can
*************** fold_range_test (tree exp)
*** 4431,4437 ****
/* 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)
--- 4431,4437 ----
/* 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 (LOGICAL_OP_NON_SHORT_CIRCUIT
&& lhs != 0 && rhs != 0
&& (TREE_CODE (exp) == TRUTH_ANDIF_EXPR
|| TREE_CODE (exp) == TRUTH_ORIF_EXPR)
*************** fold_truthop (enum tree_code code, tree
*** 4653,4659 ****
ll_arg, rl_arg),
fold_convert (TREE_TYPE (ll_arg), integer_zero_node));
! return build2 (code, truth_type, lhs, rhs);
}
/* See if the comparisons can be merged. Then get all the parameters for
--- 4653,4660 ----
ll_arg, rl_arg),
fold_convert (TREE_TYPE (ll_arg), integer_zero_node));
! if (LOGICAL_OP_NON_SHORT_CIRCUIT)
! return build2 (code, truth_type, lhs, rhs);
}
/* See if the comparisons can be merged. Then get all the parameters for
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.346
diff -c -3 -p -r1.346 rs6000.h
*** config/rs6000/rs6000.h 14 Nov 2004 20:28:58 -0000 1.346
--- config/rs6000/rs6000.h 18 Nov 2004 12:01:04 -0000
*************** extern const char *rs6000_warn_altivec_l
*** 1096,1104 ****
#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
--- 1096,1104 ----
#define BRANCH_COST 3
/* Override BRANCH_COST heuristic which empirically produces worse
! performance for removing short circuiting from the logical ops. */
! #define LOGICAL_OP_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