public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/57057] New: Bad optimization on x86 for minps and maxps
@ 2013-04-24 16:41 mathias at gaunard dot com
  2013-04-24 16:42 ` [Bug target/57057] " mathias at gaunard dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mathias at gaunard dot com @ 2013-04-24 16:41 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 57057
           Summary: Bad optimization on x86 for minps and maxps
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mathias@gaunard.com


When optimization -O1 or greater is enabled, minps and maxps will incorrectly
deal with nan values.
icc gives the correct result.

See the attached C testcase, with -O0 it displays the correct result:
res1 = (1.000000 1.000000 1.000000 1.000000)
res2 = (-nan -nan -nan -nan)
res3 = (1.000000 1.000000 1.000000 1.000000)
res4 = (-nan -nan -nan -nan)

With -O1 it displays
res1 = (1.000000 1.000000 1.000000 1.000000)
res2 = (1.000000 1.000000 1.000000 1.000000)
res3 = (-nan -nan -nan -nan)
res4 = (-nan -nan -nan -nan)

The same also happens with the double-precision and AVX variants.


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

* [Bug target/57057] Bad optimization on x86 for minps and maxps
  2013-04-24 16:41 [Bug target/57057] New: Bad optimization on x86 for minps and maxps mathias at gaunard dot com
@ 2013-04-24 16:42 ` mathias at gaunard dot com
  2013-04-25  8:14 ` rguenth at gcc dot gnu.org
  2021-07-29 23:43 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: mathias at gaunard dot com @ 2013-04-24 16:42 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Mathias Gaunard <mathias at gaunard dot com> 2013-04-24 16:42:23 UTC ---
Created attachment 29931
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29931
bad optimisation testcase


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

* [Bug target/57057] Bad optimization on x86 for minps and maxps
  2013-04-24 16:41 [Bug target/57057] New: Bad optimization on x86 for minps and maxps mathias at gaunard dot com
  2013-04-24 16:42 ` [Bug target/57057] " mathias at gaunard dot com
@ 2013-04-25  8:14 ` rguenth at gcc dot gnu.org
  2021-07-29 23:43 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-25  8:14 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Target|                            |x86_64-*-*, i?86-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-25
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-25 08:14:23 UTC ---
That it's "fixed" with -O1 is because the different MINPS invocations are
CSEd and only the first one is carried out.

The issue here is that MINPS is not commutative, but the SMIN RTX code
is specified as being commutative.  Which means with !flag_finite_math_only
the x86 backend has to use an UNSPEC to expand __builtin_ia32_minps and
friends.


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

* [Bug target/57057] Bad optimization on x86 for minps and maxps
  2013-04-24 16:41 [Bug target/57057] New: Bad optimization on x86 for minps and maxps mathias at gaunard dot com
  2013-04-24 16:42 ` [Bug target/57057] " mathias at gaunard dot com
  2013-04-25  8:14 ` rguenth at gcc dot gnu.org
@ 2021-07-29 23:43 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-29 23:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was fixed for GCC 6.3+ and is a dup of bug 72867.

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

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

end of thread, other threads:[~2021-07-29 23:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-24 16:41 [Bug target/57057] New: Bad optimization on x86 for minps and maxps mathias at gaunard dot com
2013-04-24 16:42 ` [Bug target/57057] " mathias at gaunard dot com
2013-04-25  8:14 ` rguenth at gcc dot gnu.org
2021-07-29 23:43 ` 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).