public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/17907] New: fma modifies and does not reset SSE rounding mode on 32bit machines
@ 2015-01-30 11:59 simonbyrne at gmail dot com
  2015-01-30 14:55 ` [Bug math/17907] " simonbyrne at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: simonbyrne at gmail dot com @ 2015-01-30 11:59 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17907

            Bug ID: 17907
           Summary: fma modifies and does not reset SSE rounding mode on
                    32bit machines
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: simonbyrne at gmail dot com

Created attachment 8091
  --> https://sourceware.org/bugzilla/attachment.cgi?id=8091&action=edit
fma rounding mode test function

The software fma function modifies the rounding mode for SSE floating point
instructions (to round-toward-zero), but does not reset it correctly, on 32bit
(686) processors. The x87 rounding mode is unaffected.

Attached is a sample program: compile on a 32bit machine with gcc:

$ gcc fmacheck.c -o fmacheck -lm -msse2 -mfpmath=sse

or clang:

$ clang fmacheck.c -o fmacheck -lm

When run as

$ ./fmacheck 0x1.0000000000001p+0

it should give
0x1.ffffffffffffep-1
if rounding mode is the default (round-to-nearest). If the rounding mode has
been incorrectly modified to be round-toward-zero, then you will get
0x1.ffffffffffffdp-1

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug math/17907] fma modifies and does not reset SSE rounding mode on 32bit machines
  2015-01-30 11:59 [Bug math/17907] New: fma modifies and does not reset SSE rounding mode on 32bit machines simonbyrne at gmail dot com
@ 2015-01-30 14:55 ` simonbyrne at gmail dot com
  2015-01-30 15:14 ` jsm28 at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: simonbyrne at gmail dot com @ 2015-01-30 14:55 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17907

Simon Byrne <simonbyrne at gmail dot com> changed:

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug math/17907] fma modifies and does not reset SSE rounding mode on 32bit machines
  2015-01-30 11:59 [Bug math/17907] New: fma modifies and does not reset SSE rounding mode on 32bit machines simonbyrne at gmail dot com
  2015-01-30 14:55 ` [Bug math/17907] " simonbyrne at gmail dot com
@ 2015-01-30 15:14 ` jsm28 at gcc dot gnu.org
  2015-01-30 15:22 ` joseph at codesourcery dot com
  2015-01-30 16:15 ` simonbyrne at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2015-01-30 15:14 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17907

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

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

--- Comment #1 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
This looks like it would have been a consequence of bug 16064, fixed for 2.20.

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug math/17907] fma modifies and does not reset SSE rounding mode on 32bit machines
  2015-01-30 11:59 [Bug math/17907] New: fma modifies and does not reset SSE rounding mode on 32bit machines simonbyrne at gmail dot com
  2015-01-30 14:55 ` [Bug math/17907] " simonbyrne at gmail dot com
  2015-01-30 15:14 ` jsm28 at gcc dot gnu.org
@ 2015-01-30 15:22 ` joseph at codesourcery dot com
  2015-01-30 16:15 ` simonbyrne at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2015-01-30 15:22 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17907

--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
(More specifically: i386 uses sysdeps/ieee754/ldbl-96/s_fma.c, which saves 
state with feholdexcept, sets the rounding mode (twice) with fesetround, 
and then restores state, with exceptions merged, with feupdateenv.  This 
was the sort of pattern that was mishandled before bug 16064 was fixed, 
because fesetround sets the SSE rounding mode but the fenv_t functions 
used not to handle it.)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug math/17907] fma modifies and does not reset SSE rounding mode on 32bit machines
  2015-01-30 11:59 [Bug math/17907] New: fma modifies and does not reset SSE rounding mode on 32bit machines simonbyrne at gmail dot com
                   ` (2 preceding siblings ...)
  2015-01-30 15:22 ` joseph at codesourcery dot com
@ 2015-01-30 16:15 ` simonbyrne at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: simonbyrne at gmail dot com @ 2015-01-30 16:15 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17907

--- Comment #3 from Simon Byrne <simonbyrne at gmail dot com> ---
Great, thanks for letting me know.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

end of thread, other threads:[~2015-01-30 16:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-30 11:59 [Bug math/17907] New: fma modifies and does not reset SSE rounding mode on 32bit machines simonbyrne at gmail dot com
2015-01-30 14:55 ` [Bug math/17907] " simonbyrne at gmail dot com
2015-01-30 15:14 ` jsm28 at gcc dot gnu.org
2015-01-30 15:22 ` joseph at codesourcery dot com
2015-01-30 16:15 ` simonbyrne at gmail dot com

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).