public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98207] New: ARM64 IEEE math results change with -O2
@ 2020-12-08 19:53 pramsey at cleverelephant dot ca
  2020-12-08 19:54 ` [Bug c++/98207] " pramsey at cleverelephant dot ca
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pramsey at cleverelephant dot ca @ 2020-12-08 19:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98207
           Summary: ARM64 IEEE math results change with -O2
           Product: gcc
           Version: 7.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pramsey at cleverelephant dot ca
  Target Milestone: ---

Created attachment 49707
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49707&action=edit
Test program temp files built with O0

On the ARM64 platform (in particular testing on an AWS Graviton).

Linux ip-172-31-55-124.us-west-2.compute.internal
4.14.203-156.332.amzn2.aarch64 #1 SMP Fri Oct 30 19:19:46 UTC 2020 aarch64
aarch64 aarch64 GNU/Linux

A "small" program that carries out only normal arithmetic operations on double
returns a different results if g++ is called with -O0 (or with no O at all) and
-O2. 

Attached are dd-o0.ii and dd-o2.ii, the temp file outputs for compiling with
-O0 and -O2. 

On x84_64, g++ compiled code returns the same answer for both O0 and O2. 

On ARM64 and x84_64, clang++ returns the same answer for both O0 and O2. 

This test is extracted from a small routine that provides "double double"
precision math using only arithmetic operations on IEEE compliant doubles.
https://github.com/libgeos/geos/blob/master/src/math/DD.cpp

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

* [Bug c++/98207] ARM64 IEEE math results change with -O2
  2020-12-08 19:53 [Bug c++/98207] New: ARM64 IEEE math results change with -O2 pramsey at cleverelephant dot ca
@ 2020-12-08 19:54 ` pramsey at cleverelephant dot ca
  2020-12-08 20:04 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pramsey at cleverelephant dot ca @ 2020-12-08 19:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Paul Ramsey <pramsey at cleverelephant dot ca> ---
Created attachment 49708
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49708&action=edit
Test program temp files built with O2

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

* [Bug c++/98207] ARM64 IEEE math results change with -O2
  2020-12-08 19:53 [Bug c++/98207] New: ARM64 IEEE math results change with -O2 pramsey at cleverelephant dot ca
  2020-12-08 19:54 ` [Bug c++/98207] " pramsey at cleverelephant dot ca
@ 2020-12-08 20:04 ` pinskia at gcc dot gnu.org
  2020-12-08 20:05 ` pinskia at gcc dot gnu.org
  2020-12-08 20:21 ` pramsey at cleverelephant dot ca
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-12-08 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The default is to use fused multiple add.
If you don't want to use FMA, then use -ffp-contract=off (the default =fast).


x84_64 by default does not have a fused-multiple-add instruction without extra
options (to enable the ISA for fused multiple add instruction).

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

* [Bug c++/98207] ARM64 IEEE math results change with -O2
  2020-12-08 19:53 [Bug c++/98207] New: ARM64 IEEE math results change with -O2 pramsey at cleverelephant dot ca
  2020-12-08 19:54 ` [Bug c++/98207] " pramsey at cleverelephant dot ca
  2020-12-08 20:04 ` pinskia at gcc dot gnu.org
@ 2020-12-08 20:05 ` pinskia at gcc dot gnu.org
  2020-12-08 20:21 ` pramsey at cleverelephant dot ca
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-12-08 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> The default is to use fused multiple add.
> If you don't want to use FMA, then use -ffp-contract=off (the default =fast).
> 
> 
> x84_64 by default does not have a fused-multiple-add instruction without
> extra options (to enable the ISA for fused multiple add instruction).

Note this is still IEEE compliant FP and C standard compliant too.

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

* [Bug c++/98207] ARM64 IEEE math results change with -O2
  2020-12-08 19:53 [Bug c++/98207] New: ARM64 IEEE math results change with -O2 pramsey at cleverelephant dot ca
                   ` (2 preceding siblings ...)
  2020-12-08 20:05 ` pinskia at gcc dot gnu.org
@ 2020-12-08 20:21 ` pramsey at cleverelephant dot ca
  3 siblings, 0 replies; 5+ messages in thread
From: pramsey at cleverelephant dot ca @ 2020-12-08 20:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Paul Ramsey <pramsey at cleverelephant dot ca> ---
Thanks for the pointer!

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

end of thread, other threads:[~2020-12-08 20:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 19:53 [Bug c++/98207] New: ARM64 IEEE math results change with -O2 pramsey at cleverelephant dot ca
2020-12-08 19:54 ` [Bug c++/98207] " pramsey at cleverelephant dot ca
2020-12-08 20:04 ` pinskia at gcc dot gnu.org
2020-12-08 20:05 ` pinskia at gcc dot gnu.org
2020-12-08 20:21 ` pramsey at cleverelephant dot ca

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