public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109843] New: signbit comparisons -> copysign optimization
@ 2023-05-13 16:45 pinskia at gcc dot gnu.org
  2023-11-09  4:24 ` [Bug tree-optimization/109843] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-13 16:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109843
           Summary: signbit comparisons -> copysign optimization
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

float copysign1(float  x, float y)
{
        bool t = __builtin_signbit(x) == 0;
        bool t1 = __builtin_signbit(y) == 0;
        return (t == t1) ? y : -y;
}
float copysign2(float  x, float y)
{
        bool t = __builtin_signbit(x) != 0;
        bool t1 = __builtin_signbit(y) != 0;
        return (t == t1) ? y : -y;
}
float copysign3(float  x, float y)
{
        bool t = __builtin_signbit(x) != 0;
        bool t1 = __builtin_signbit(y) == 0;
        return (t != t1) ? y : -y;
}
float copysign4(float  x, float y)
{
        bool t = __builtin_signbit(x) == 0;
        bool t1 = __builtin_signbit(y) != 0;
        return (t != t1) ? y : -y;
}
float copysign5(float  x, float y)
{
        return __builtin_copysignf(x, y);
}

These all should end up being the same code.
Hopefully I didn't mess these up.

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

* [Bug tree-optimization/109843] signbit comparisons -> copysign optimization
  2023-05-13 16:45 [Bug tree-optimization/109843] New: signbit comparisons -> copysign optimization pinskia at gcc dot gnu.org
@ 2023-11-09  4:24 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-09  4:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-11-09
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Mine.

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

end of thread, other threads:[~2023-11-09  4:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-13 16:45 [Bug tree-optimization/109843] New: signbit comparisons -> copysign optimization pinskia at gcc dot gnu.org
2023-11-09  4:24 ` [Bug tree-optimization/109843] " 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).