public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: vladimir.mezentsev@oracle.com
To: gcc-patches@gcc.gnu.org
Cc: vladimir.mezentsev@oracle.com
Subject: [PATCH] PR libgcc/59714 complex division is surprising on aarch64
Date: Wed, 25 Oct 2017 17:29:00 -0000	[thread overview]
Message-ID: <1508952211-12992-1-git-send-email-vladimir.mezentsev@oracle.com> (raw)

From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

FMA (floating-point multiply-add) instructions are supported on aarch64.
These instructions can produce different result if two operations executed separately.
-ffp-contract=off doesn't allow the FMA instructions.

Tested on aarch64-unknown-linux-gnu. No regression. Two failed tests now passed.

ChangeLog:
2017-10-25  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

PR libgcc/59714
* libgcc/Makefile.in: Add -ffp-contract=off
---
 libgcc/Makefile.in | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index a1a392d..f313556 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -455,6 +455,14 @@ ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
   lib2funcs += $(subst XX,di,$(dwfloatfuncs))
 endif
 
+# Disable FMA (floating-point multiply-add) instructions for complex division.
+# These instructions can produce different result if two operations executed separately.
+LIBGCC2_FFP_CONTRAST_CFLAGS = -ffp-contract=off
+LIB2_DIV3_FUNCS = _divdc3 _divhc3 _divsc3
+lib2-div3-o = $(patsubst %,%$(objext),$(LIB2_DIV3_FUNCS))
+lib2-div3-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIV3_FUNCS))
+$(lib2-div3-o) $(lib2-div3-s-o): LIBGCC2_CFLAGS += $(LIBGCC2_FFP_CONTRAST_CFLAGS)
+
 # These might cause a divide overflow trap and so are compiled with
 # unwinder info.
 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _divmoddi4 \
-- 
1.8.3.1

             reply	other threads:[~2017-10-25 17:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25 17:29 vladimir.mezentsev [this message]
2017-10-25 17:29 ` Joseph Myers
2017-10-25 19:19   ` vladimir.mezentsev
2017-10-25 20:04     ` Joseph Myers
  -- strict thread matches above, loose matches on Subject: below --
2018-02-06  7:20 vladimir.mezentsev
2018-02-06 16:53 ` Joseph Myers
2018-02-07  0:25   ` vladimir.mezentsev
2018-02-07  0:31     ` Joseph Myers
2018-01-25 20:40 vladimir.mezentsev
2018-01-26  3:39 ` Joseph Myers
2018-01-29 20:54   ` vladimir.mezentsev
2018-01-29 21:01     ` Joseph Myers
2018-02-06  8:55       ` vladimir.mezentsev
2018-02-06 17:13         ` Joseph Myers
2017-10-19 13:20 Wilco Dijkstra
2017-10-19 13:52 ` Richard Earnshaw (lists)
2017-10-19 17:13   ` Vladimir Mezentsev
2017-10-19 17:24     ` Wilco Dijkstra
2017-10-25  3:26       ` vladimir.mezentsev
2017-10-18 21:32 vladimir.mezentsev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1508952211-12992-1-git-send-email-vladimir.mezentsev@oracle.com \
    --to=vladimir.mezentsev@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).