public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52034] New: __builtin_copysign optimization suboptimal
@ 2012-01-29  0:47 drepper.fsp at gmail dot com
  2012-01-29  2:40 ` [Bug target/52034] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: drepper.fsp at gmail dot com @ 2012-01-29  0:47 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52034
           Summary: __builtin_copysign optimization suboptimal
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: drepper.fsp@gmail.com


The most trivial __builtin_copysign optimization is not optimal:

double f(double a, double b)
{
  return __builtin_copysign(a,b);
}

With gcc 4.6.2 this gets compiled to

    movapd    %xmm1, %xmm2
    andpd    .LC0(%rip), %xmm0
    andpd    .LC1(%rip), %xmm2
    orpd    %xmm2, %xmm0
    ret

There is no reason for %xmm1 to be duplicated to %xmm2.  This is sufficient:

    andpd    .LC0(%rip), %xmm0
    andpd    .LC1(%rip), %xmm1
    orpd    %xmm1, %xmm0
    ret

The same happens with more complicated code sequences.


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

* [Bug target/52034] __builtin_copysign optimization suboptimal
  2012-01-29  0:47 [Bug tree-optimization/52034] New: __builtin_copysign optimization suboptimal drepper.fsp at gmail dot com
@ 2012-01-29  2:40 ` pinskia at gcc dot gnu.org
  2012-01-30  9:43 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-29  2:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-* i?86-*-*
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization, ra
   Last reconfirmed|                            |2012-01-29
          Component|tree-optimization           |target
     Ever Confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-29 01:27:53 UTC ---
Confirmed.  This is either the way copysign rtl is done on x86_64 or is a
register allocator issue with the copysign rtl.


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

* [Bug target/52034] __builtin_copysign optimization suboptimal
  2012-01-29  0:47 [Bug tree-optimization/52034] New: __builtin_copysign optimization suboptimal drepper.fsp at gmail dot com
  2012-01-29  2:40 ` [Bug target/52034] " pinskia at gcc dot gnu.org
@ 2012-01-30  9:43 ` rguenth at gcc dot gnu.org
  2021-09-04  6:21 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-01-30  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-30 09:35:37 UTC ---
It's an RA issue I think - the RA isn't very clever when it comes to
coalescing pseudos with incoming or outgoing fixed regs.


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

* [Bug target/52034] __builtin_copysign optimization suboptimal
  2012-01-29  0:47 [Bug tree-optimization/52034] New: __builtin_copysign optimization suboptimal drepper.fsp at gmail dot com
  2012-01-29  2:40 ` [Bug target/52034] " pinskia at gcc dot gnu.org
  2012-01-30  9:43 ` rguenth at gcc dot gnu.org
@ 2021-09-04  6:21 ` pinskia at gcc dot gnu.org
  2021-09-04  6:36 ` pinskia at gcc dot gnu.org
  2021-09-04  6:38 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-04  6:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=89984
           Severity|normal                      |enhancement

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
related to PR 89984.

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

* [Bug target/52034] __builtin_copysign optimization suboptimal
  2012-01-29  0:47 [Bug tree-optimization/52034] New: __builtin_copysign optimization suboptimal drepper.fsp at gmail dot com
                   ` (2 preceding siblings ...)
  2021-09-04  6:21 ` pinskia at gcc dot gnu.org
@ 2021-09-04  6:36 ` pinskia at gcc dot gnu.org
  2021-09-04  6:38 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-04  6:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Th

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

* [Bug target/52034] __builtin_copysign optimization suboptimal
  2012-01-29  0:47 [Bug tree-optimization/52034] New: __builtin_copysign optimization suboptimal drepper.fsp at gmail dot com
                   ` (3 preceding siblings ...)
  2021-09-04  6:36 ` pinskia at gcc dot gnu.org
@ 2021-09-04  6:38 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-04  6:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was a scrach_register issue which was fixed in r11-4577.

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

end of thread, other threads:[~2021-09-04  6:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-29  0:47 [Bug tree-optimization/52034] New: __builtin_copysign optimization suboptimal drepper.fsp at gmail dot com
2012-01-29  2:40 ` [Bug target/52034] " pinskia at gcc dot gnu.org
2012-01-30  9:43 ` rguenth at gcc dot gnu.org
2021-09-04  6:21 ` pinskia at gcc dot gnu.org
2021-09-04  6:36 ` pinskia at gcc dot gnu.org
2021-09-04  6:38 ` 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).