public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled
@ 2011-09-14 16:20 mathias at gaunard dot com
  2011-10-20  8:58 ` [Bug target/50396] " mathias at gaunard dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: mathias at gaunard dot com @ 2011-09-14 16:20 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50396
           Summary: SSE division by zero generates incorrect code with
                    optimizations enabled
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mathias@gaunard.com


Created attachment 25273
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25273
divide by zero example

The attached C code, written using SSE intrinsics, prints -nan when no
optimizations are used (as expected) and 0 otherwise.

It seems constant folding of the divps instruction doesn't do the right thing.

It works correctly when the first argument is non-zero though (including minus
zero).


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

* [Bug target/50396] SSE division by zero generates incorrect code with optimizations enabled
  2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
@ 2011-10-20  8:58 ` mathias at gaunard dot com
  2011-10-20  9:11 ` [Bug rtl-optimization/50396] " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: mathias at gaunard dot com @ 2011-10-20  8:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Mathias Gaunard <mathias at gaunard dot com> 2011-10-20 08:58:19 UTC ---
This bug has stayed as unconfirmed for a while.
Is there anything that I could do to help?


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

* [Bug rtl-optimization/50396] SSE division by zero generates incorrect code with optimizations enabled
  2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
  2011-10-20  8:58 ` [Bug target/50396] " mathias at gaunard dot com
@ 2011-10-20  9:11 ` rguenth at gcc dot gnu.org
  2011-10-20  9:13 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-20  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-10-20
          Component|target                      |rtl-optimization
            Version|unknown                     |4.7.0
     Ever Confirmed|0                           |1
      Known to fail|                            |4.5.2, 4.7.0

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-20 09:11:06 UTC ---
Confirmed.  Broken by CSE1 on RTL at -O1.


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

* [Bug rtl-optimization/50396] SSE division by zero generates incorrect code with optimizations enabled
  2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
  2011-10-20  8:58 ` [Bug target/50396] " mathias at gaunard dot com
  2011-10-20  9:11 ` [Bug rtl-optimization/50396] " rguenth at gcc dot gnu.org
@ 2011-10-20  9:13 ` rguenth at gcc dot gnu.org
  2011-12-22 15:12 ` loufoque at gmail dot com
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-10-20  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-20 09:13:21 UTC ---
    case DIV:
      /* Handle floating point and integers separately.  */
      if (SCALAR_FLOAT_MODE_P (mode))
        {

should probably be FLOAT_MODE_P (mode).


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

* [Bug rtl-optimization/50396] SSE division by zero generates incorrect code with optimizations enabled
  2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
                   ` (2 preceding siblings ...)
  2011-10-20  9:13 ` rguenth at gcc dot gnu.org
@ 2011-12-22 15:12 ` loufoque at gmail dot com
  2011-12-22 15:16 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: loufoque at gmail dot com @ 2011-12-22 15:12 UTC (permalink / raw)
  To: gcc-bugs

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

Mathias Gaunard <loufoque at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |loufoque at gmail dot com

--- Comment #4 from Mathias Gaunard <loufoque at gmail dot com> 2011-12-22 15:01:02 UTC ---
What's missing to get this fixed?

Previous comment suggests the fix is trivial.


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

* [Bug rtl-optimization/50396] SSE division by zero generates incorrect code with optimizations enabled
  2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
                   ` (3 preceding siblings ...)
  2011-12-22 15:12 ` loufoque at gmail dot com
@ 2011-12-22 15:16 ` rguenth at gcc dot gnu.org
  2011-12-23  9:14 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-22 15:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #5 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-22 15:14:32 UTC ---
Sorry, forgot about this issue.


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

* [Bug rtl-optimization/50396] SSE division by zero generates incorrect code with optimizations enabled
  2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
                   ` (4 preceding siblings ...)
  2011-12-22 15:16 ` rguenth at gcc dot gnu.org
@ 2011-12-23  9:14 ` rguenth at gcc dot gnu.org
  2011-12-23  9:17 ` rguenth at gcc dot gnu.org
  2011-12-23 10:19 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-23  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-23 09:10:27 UTC ---
Author: rguenth
Date: Fri Dec 23 09:10:18 2011
New Revision: 182653

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182653
Log:
2011-12-23  Richard Guenther  <rguenther@suse.de>

    PR rtl-optimization/50396
    * simplify-rtx.c (simplify_binary_operation_1): Properly
    guard code that only works for integers.

    * gcc.dg/torture/pr50396.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/pr50396.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/simplify-rtx.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug rtl-optimization/50396] SSE division by zero generates incorrect code with optimizations enabled
  2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
                   ` (5 preceding siblings ...)
  2011-12-23  9:14 ` rguenth at gcc dot gnu.org
@ 2011-12-23  9:17 ` rguenth at gcc dot gnu.org
  2011-12-23 10:19 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-23  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-23 09:16:16 UTC ---
Author: rguenth
Date: Fri Dec 23 09:16:08 2011
New Revision: 182654

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182654
Log:
2011-12-23  Richard Guenther  <rguenther@suse.de>

    PR rtl-optimization/50396
    * simplify-rtx.c (simplify_binary_operation_1): Properly
    guard code that only works for integers.

    * gcc.dg/torture/pr50396.c: New testcase.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.dg/torture/pr50396.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/simplify-rtx.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug rtl-optimization/50396] SSE division by zero generates incorrect code with optimizations enabled
  2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
                   ` (6 preceding siblings ...)
  2011-12-23  9:17 ` rguenth at gcc dot gnu.org
@ 2011-12-23 10:19 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-23 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to work|                            |4.6.3, 4.7.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.3
      Known to fail|4.7.0                       |4.6.2
           Severity|major                       |normal

--- Comment #8 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-12-23 09:19:30 UTC ---
Fixed for 4.6.3.


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

end of thread, other threads:[~2011-12-23  9:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-14 16:20 [Bug target/50396] New: SSE division by zero generates incorrect code with optimizations enabled mathias at gaunard dot com
2011-10-20  8:58 ` [Bug target/50396] " mathias at gaunard dot com
2011-10-20  9:11 ` [Bug rtl-optimization/50396] " rguenth at gcc dot gnu.org
2011-10-20  9:13 ` rguenth at gcc dot gnu.org
2011-12-22 15:12 ` loufoque at gmail dot com
2011-12-22 15:16 ` rguenth at gcc dot gnu.org
2011-12-23  9:14 ` rguenth at gcc dot gnu.org
2011-12-23  9:17 ` rguenth at gcc dot gnu.org
2011-12-23 10:19 ` 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).