public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/55180] New: Missed optimization abs(-x) -> abs(x)
@ 2012-11-02 14:56 glisse at gcc dot gnu.org
  2012-11-02 15:43 ` [Bug tree-optimization/55180] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-11-02 14:56 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55180

             Bug #: 55180
           Summary: Missed optimization abs(-x) -> abs(x)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: glisse@gcc.gnu.org


double f(double x){
  double y=-x;
  return __builtin_fabs(y);
}

The negation doesn't disappear, even at -Ofast, I still see both "xor" and
"and" in the asm. (I don't think this optimization requires any unsafe math
option, but I am not completely sure about the trapping behavior)

Note that if I write __builtin_fabs(-x), the negation is removed before it has
a chance to appear in a dump.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/55180] Missed optimization abs(-x) -> abs(x)
  2012-11-02 14:56 [Bug tree-optimization/55180] New: Missed optimization abs(-x) -> abs(x) glisse at gcc dot gnu.org
@ 2012-11-02 15:43 ` pinskia at gcc dot gnu.org
  2012-11-02 16:12 ` glisse at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-11-02 15:43 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55180

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Depends on|                            |16107

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-11-02 15:43:29 UTC ---
Related to or a dup of bug 16107.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/55180] Missed optimization abs(-x) -> abs(x)
  2012-11-02 14:56 [Bug tree-optimization/55180] New: Missed optimization abs(-x) -> abs(x) glisse at gcc dot gnu.org
  2012-11-02 15:43 ` [Bug tree-optimization/55180] " pinskia at gcc dot gnu.org
@ 2012-11-02 16:12 ` glisse at gcc dot gnu.org
  2014-12-01  4:28 ` pinskia at gcc dot gnu.org
  2014-12-01  4:28 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-11-02 16:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55180

Marc Glisse <glisse at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> 2012-11-02 16:11:43 UTC ---
Thanks, I had missed that one. ABS_EXPR is a bit special in that it has its own
tree code, instead of appearing as a call to a builtin function, but the issue
is the same indeed, the optimization is there but can never be applied.

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/55180] Missed optimization abs(-x) -> abs(x)
  2012-11-02 14:56 [Bug tree-optimization/55180] New: Missed optimization abs(-x) -> abs(x) glisse at gcc dot gnu.org
  2012-11-02 15:43 ` [Bug tree-optimization/55180] " pinskia at gcc dot gnu.org
  2012-11-02 16:12 ` glisse at gcc dot gnu.org
@ 2014-12-01  4:28 ` pinskia at gcc dot gnu.org
  2014-12-01  4:28 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-12-01  4:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55180

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|DUPLICATE                   |---

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reopening since this is not a dup of that bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/55180] Missed optimization abs(-x) -> abs(x)
  2012-11-02 14:56 [Bug tree-optimization/55180] New: Missed optimization abs(-x) -> abs(x) glisse at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-12-01  4:28 ` pinskia at gcc dot gnu.org
@ 2014-12-01  4:28 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-12-01  4:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55180

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
But it was fixed in GCC 5.0.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-01  4:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-02 14:56 [Bug tree-optimization/55180] New: Missed optimization abs(-x) -> abs(x) glisse at gcc dot gnu.org
2012-11-02 15:43 ` [Bug tree-optimization/55180] " pinskia at gcc dot gnu.org
2012-11-02 16:12 ` glisse at gcc dot gnu.org
2014-12-01  4:28 ` pinskia at gcc dot gnu.org
2014-12-01  4:28 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).