This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Should gcc-4.0 apply mathematical associative rules for addition or multiplication
- From: Gabriel Dos Reis <gdr at cs dot tamu dot edu>
- To: Fariborz Jahanian <fjahanian at apple dot com>
- Cc: Roger Sayle <roger at eyesopen dot com>, gcc at gcc dot gnu dot org,Andrew Pinski <pinskia at physics dot uc dot edu>
- Date: 04 Oct 2004 21:35:02 -0500
- Subject: Re: Should gcc-4.0 apply mathematical associative rules for addition or multiplication
- Organization: Texas A&M University, Department of Computer Science
- References: <Pine.LNX.4.44.0410041742400.1190-100000@www.eyesopen.com><9C974230-1669-11D9-957B-000A95BA54A6@apple.com>
Fariborz Jahanian <fjahanian@apple.com> writes:
| On Oct 4, 2004, at 4:48 PM, Roger Sayle wrote:
|
| >
| > On Mon, 4 Oct 2004, Andrew Pinski wrote:
| >> Obviously I mean:
| >> Index: tree-ssa-dom.c
| >> ===================================================================
| >> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-dom.c,v
| >> retrieving revision 2.58
| >> diff -u -p -r2.58 tree-ssa-dom.c
| >> --- tree-ssa-dom.c 4 Oct 2004 13:19:20 -0000 2.58
| >> +++ tree-ssa-dom.c 4 Oct 2004 23:19:07 -0000
| >> @@ -1598,7 +1598,9 @@ simplify_rhs_and_lookup_avail_expr (stru
| >> assignment. Add minus to this, as we handle it specially
| >> below.
| >> */
| >> if ((associative_tree_code (rhs_code) || rhs_code == MINUS_EXPR)
| >> && TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
| >> - && is_gimple_min_invariant (TREE_OPERAND (rhs, 1)))
| >> + && is_gimple_min_invariant (TREE_OPERAND (rhs, 1))
| >> + && (!FLOAT_TYPE_P (TREE_TYPE (rhs))
| >> + || flag_unsafe_math_optimizations))
| >> {
| >> tree rhs_def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0));
| >>
| >
| > Ok for mainline, after bootstrap and regression testing, with a
| > ChangeLog
| > entry and a suitable test case for the testsuite.
|
| associative_tree_code also returns true for MIN_EXPR/MAX_EXPR. I think
| we want to only
| exclude PLUS_EXPR/MULT_EXPR.
and all additive expressions (e.g. MINUS_EXPR) and multiplicative
expressions (include division).
-- Gaby