Bug 29985 - sin (x) / cos (x) is not always folded to tan (x)
Summary: sin (x) / cos (x) is not always folded to tan (x)
Status: RESOLVED DUPLICATE of bug 14541
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on: 15459
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-26 07:44 UTC by Uroš Bizjak
Modified: 2006-11-26 08:15 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-11-26 08:01:12


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Uroš Bizjak 2006-11-26 07:44:52 UTC
This testcase shows the problem when compiled with -ffast-math:

double test1(double x)
{
        double y1, y2;

        y1 = sin(x);
        y2 = cos(x);

        return y1 / y2;
}

double test2(double x)
{
        return sin(x) / cos(x);
}

gcc -O2 -ffast-math:

_.099t.optimized:

;; Function test2 (test2)

Analyzing Edge Insertions.
test2 (x)
{
<bb 2>:
  return __builtin_tan (x) [tail call];

}



;; Function test1 (test1)

Analyzing Edge Insertions.
test1 (x)
{
<bb 2>:
  return sin (x) / cos (x);

}
Comment 1 Andrew Pinski 2006-11-26 08:01:12 UTC
This comes down to a tree combiner really.
Comment 2 Andrew Pinski 2006-11-26 08:15:02 UTC
Actually I think it is better to mark this as a dup of bug 14541 which is all about combining expressions for math builtins.

*** This bug has been marked as a duplicate of 14541 ***