Bug 16107 - missed optimization with some math function builtins
Summary: missed optimization with some math function builtins
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 enhancement
Target Milestone: ---
Assignee: Andrew Pinski
URL:
Keywords: missed-optimization
Depends on: 15459
Blocks: 55180
  Show dependency treegraph
 
Reported: 2004-06-21 05:43 UTC by Andrew Pinski
Modified: 2017-12-10 13:47 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 6.0
Known to fail:
Last reconfirmed: 2006-03-05 17:17:38


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2004-06-21 05:43:56 UTC
Even after my tree combine pass, there are some math function builtins which I still not simplify 
because I do not regimplify calls expression yet.  I will handle this case after I sumbit and commit my 
tree-combiner.
double t(double x)
{
 x = -x;
 x = cos (x);
 return x;
}
double t1(double x)
{
 x = cos (-x);
 return x;
}
Comment 1 Andrew Pinski 2004-06-21 05:45:41 UTC
Mine.
Comment 2 Andrew Pinski 2004-06-21 05:46:21 UTC
I should note that cos(-x) == cos(x);
Comment 3 Andrew Pinski 2004-08-29 19:36:30 UTC
The two FIXMEs in my tree combiner:
  /* FIXME: do not abort for the call case as this can happen for an example
     -cos(-a) == cos (a) but this does not show up here as we reject it when
     calculating the size.  */
    /* If we have more than three or zero, we cannot handle this case so we
       return a relatively huge count saying we cannot handle it.
       FIXME: Handle the cost of a call expression.  */
Comment 4 Andrew Pinski 2005-07-12 21:25:47 UTC
It might be a while for me to rewrite the tree combiner so unassigning for now.
Comment 5 Marc Glisse 2012-11-02 16:11:43 UTC
*** Bug 55180 has been marked as a duplicate of this bug. ***
Comment 6 Andrew Pinski 2014-12-01 04:27:41 UTC
I have a patch using match-and-simplify.
Comment 7 naveenh 2015-08-17 04:48:18 UTC
Author: naveenh
Date: Mon Aug 17 04:47:45 2015
New Revision: 226934

URL: https://gcc.gnu.org/viewcvs?rev=226934&root=gcc&view=rev
Log:
2015-08-17  Richard Biener  <rguenther@suse.de>
	    Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>

	PR middle-end/16107
	* match.pd (div (coss (op @0) : New simplifier.


Added:
    trunk/gcc/testsuite/gcc.dg/pr16107.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/match.pd
Comment 8 Marc Glisse 2015-12-15 19:25:14 UTC
Fixed a few months ago.