From patchwork Thu Jan 14 21:41:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 10386 Received: (qmail 7111 invoked by alias); 14 Jan 2016 21:41:50 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 6677 invoked by uid 89); 14 Jan 2016 21:41:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.3 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, NO_DNS_FOR_FROM, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=fenv_t, __fma, sk:bc3677d, 175, 7 X-HELO: mga11.intel.com X-ExtLoop1: 1 Date: Thu, 14 Jan 2016 13:41:45 -0800 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] Call math_opt_barrier inside if Message-ID: <20160114214145.GA22984@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) Since floating-point operation may trigger floating-point exceptions, we call math_opt_barrier inside if to prevent code motion. Tested on x86-64. OK for trunk? H.J. --- [BZ #19465] * sysdeps/ieee754/dbl-64/s_fma.c (__fma): Call math_opt_barrier inside if. --- sysdeps/ieee754/dbl-64/s_fma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c index bc3677d..a349243 100644 --- a/sysdeps/ieee754/dbl-64/s_fma.c +++ b/sysdeps/ieee754/dbl-64/s_fma.c @@ -175,7 +175,10 @@ __fma (double x, double y, double z) /* Ensure correct sign of exact 0 + 0. */ if (__glibc_unlikely ((x == 0 || y == 0) && z == 0)) - return x * y + z; + { + x = math_opt_barrier (x); + return x * y + z; + } fenv_t env; libc_feholdexcept_setround (&env, FE_TONEAREST);