public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96715] New: Failure to optimize copysign of variable by negated variable
@ 2020-08-19 20:31 gabravier at gmail dot com
  2020-08-24 14:13 ` [Bug tree-optimization/96715] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: gabravier at gmail dot com @ 2020-08-19 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96715
           Summary: Failure to optimize copysign of variable by negated
                    variable
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gabravier at gmail dot com
  Target Milestone: ---

float f(float x, float y)
{
    return __builtin_copysignf(x, -x);
}

This can be optimized to `return -x;`. This transformation is done by LLVM, but
not by GCC.

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

* [Bug tree-optimization/96715] Failure to optimize copysign of variable by negated variable
  2020-08-19 20:31 [Bug tree-optimization/96715] New: Failure to optimize copysign of variable by negated variable gabravier at gmail dot com
@ 2020-08-24 14:13 ` jakub at gcc dot gnu.org
  2020-08-25  5:22 ` cvs-commit at gcc dot gnu.org
  2020-08-25 11:14 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-24 14:13 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-08-24
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 49115
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49115&action=edit
gcc11-pr96715.patch

Untested fix.

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

* [Bug tree-optimization/96715] Failure to optimize copysign of variable by negated variable
  2020-08-19 20:31 [Bug tree-optimization/96715] New: Failure to optimize copysign of variable by negated variable gabravier at gmail dot com
  2020-08-24 14:13 ` [Bug tree-optimization/96715] " jakub at gcc dot gnu.org
@ 2020-08-25  5:22 ` cvs-commit at gcc dot gnu.org
  2020-08-25 11:14 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-25  5:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:bb5e895245ebef488b63efc239f64488aef65cf1

commit r11-2832-gbb5e895245ebef488b63efc239f64488aef65cf1
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Aug 25 07:21:26 2020 +0200

    match.pd: Simplify copysign (x, -x) to -x [PR96715]

    The following patch implements an optimization suggested in the PR,
    copysign(x,-x) can be optimized into -x (even without -ffast-math,
    should work fine even for signed zeros and infinities or nans).

    2020-08-25  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/96715
            * match.pd (copysign(x,-x) -> -x): New simplification.

            * gcc.dg/tree-ssa/copy-sign-3.c: New test.

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

* [Bug tree-optimization/96715] Failure to optimize copysign of variable by negated variable
  2020-08-19 20:31 [Bug tree-optimization/96715] New: Failure to optimize copysign of variable by negated variable gabravier at gmail dot com
  2020-08-24 14:13 ` [Bug tree-optimization/96715] " jakub at gcc dot gnu.org
  2020-08-25  5:22 ` cvs-commit at gcc dot gnu.org
@ 2020-08-25 11:14 ` rguenth at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-25 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-08-25 11:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 20:31 [Bug tree-optimization/96715] New: Failure to optimize copysign of variable by negated variable gabravier at gmail dot com
2020-08-24 14:13 ` [Bug tree-optimization/96715] " jakub at gcc dot gnu.org
2020-08-25  5:22 ` cvs-commit at gcc dot gnu.org
2020-08-25 11:14 ` rguenth 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).