From patchwork Fri Nov 17 10:32:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 119147 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp344340qgn; Fri, 17 Nov 2017 02:33:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMas5T6cSnow/afyLt6nAZ26z+vxvvovtmeRfji/21WbGo9J2G6IW01uyU0tHw2uN2bWRW+Q X-Received: by 10.99.55.92 with SMTP id g28mr4739071pgn.293.1510914792018; Fri, 17 Nov 2017 02:33:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510914792; cv=none; d=google.com; s=arc-20160816; b=ze+fWFVlPe0rNuBw8Q7y3fZjiaJ7aIzWpbH+T9nmZZ1H5wuentxU4YvQBHtkwp5zeH 4dVLznwlRhjqFEOU29sOtArL5XKhmv/SddPITWv/WnRcPY3LJ8OFkGppSMisUth6c/st ofinxXXbreYp2MLT/GpkjuFqeepvyzHhFXJxJ+So987pzinVqHpvF2q2qBNcLQ1Yc8V8 L5XHAlPyxwNzD05zeLq5vszxLBn8qutdm0iQh6vzm5pLd7fD+wpSJ6kuNIVyXA0Xo4UI A9yky0VzKybkQzHmppx0auTq3CEK0fnUhaWw+KievPnpOmukbuJu/y5PwO8ThcT1lFtr nhiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:to:from:delivered-to:sender:list-help :list-post:list-archive:list-subscribe:list-unsubscribe:list-id :precedence:mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=T9Uc6Wl3sVaV/ODT69jpgGaDnxqD2miegatLx3iJexE=; b=RcKULEwPK/OWqGoMJtdcyJ4rtnDcR5uJeyezpp75EJWF2HPf8mUAaCc8lIUpDh+3uJ hI4fH2ET24K3sTCHUc5iVc6D6VNsliM7/bMVWml3T837qKo3aZJQFasx30Ru8wwQehux RMvvbiK89Eq2FleOXYMtK6YFQnS65y+ZxzgXlrIvb2Z0y1yoB1hNPCFxK+lw4y0hNWJv 1f2064q7BOph0mD89wMzV/h0Z4G0Xtu4kzxOO9JZW10BqlMDVJHx6WIrEjiVLuG/IjV4 0tsPxb5lVChHCx2+UHkBczJA17QZd8Krlz6/Gqz3F3tLzBiMG5tt5SXtxBh2Z+PKrYjF 7GhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=WLB6xq15; spf=pass (google.com: domain of libc-alpha-return-87214-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-87214-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e12si2485772pgu.744.2017.11.17.02.33.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Nov 2017 02:33:12 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-return-87214-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=WLB6xq15; spf=pass (google.com: domain of libc-alpha-return-87214-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-87214-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; q=dns; s= default; b=ywSSYDTiWq8abEXb7AHq6bQEYw/5e8pV+7TKtqOHvAMemVEZIWLmE daRA6IUH5+pg7eH8EjNbHQ5qbn+Ki8FZSpRhy5EnEVJz2pTCd+ESYV78pXKoW+T2 htOKSl0J7UsXHPEFuLz4hDTiDaMebI2uZHvNj5skM3BXLrh9KSpaOc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id; s=default; bh=/brnMXKnadd0vW74W/o4Wm6LmSo=; b=WLB6xq15eOeVlyCrdoIPqBio7fjY oM8gcJaqehzVZx6+eURUCooyTiTJagpUtqGpm2QGqDx8qmC7KzOGqdUYO9Jiq4Fz YRfneBD/KHhIOicykzperQ/ku8Hwjz/moPEGhctzDy5dFUCOVxIdPT/VhdKl1Z76 p1bS49mLl/WcLJE= Received: (qmail 49707 invoked by alias); 17 Nov 2017 10:32:53 -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 49689 invoked by uid 89); 17 Nov 2017 10:32:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, KAM_SHORT, KB_WAM_FROM_NAME_SINGLEWORD, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=5.3.1, 5, 4 X-HELO: mail-qt0-f196.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=T9Uc6Wl3sVaV/ODT69jpgGaDnxqD2miegatLx3iJexE=; b=mL8iqgSqsh1upooJ2DFY/FEt0MItukwD66NVFfFEY91q8A1znDgY8CoOqtUIxuR8ie ZyOUzuuNRgo1bv6fIHFExkr4pcMjChJHRab8TfKQSM6kUGCEBJzhT8nEDYSgXOTxeV2F ituleO6p+fabMXky9BxV8h47hIbr6m9r88uuSkA8Pf166PktOp2ATvvGLF0Ydm+45+81 P/9hj1Jf3PYgzHmZiwpMvLTzwT8Uy03QjhhQIblQCS4OtyH/IWkZM8nIUODPAagqhway XeoeftKVqIwL1qjDjaBprRAi8PfhQYc47PIuZ/geqB+szLJIz+av4ikBdmkJRnIB0pVK /Gdg== X-Gm-Message-State: AJaThX41P0XUlX8SS9/GXju0Zb7ls3LaEH+4bJSvItzdKZ6WX6MVfSZs 5/3roXOlIIloeu9Jgc7ASZjETX6mTGA= X-Received: by 10.200.34.112 with SMTP id p45mr7092652qtp.240.1510914769119; Fri, 17 Nov 2017 02:32:49 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH] aarch64: Fix f{max,min}{f} build for GCC 4.9 and 5 Date: Fri, 17 Nov 2017 08:32:42 -0200 Message-Id: <1510914762-27547-1-git-send-email-adhemerval.zanella@linaro.org> GCC 4.9 and 5 do not generate a correct f{max,min}nm instruction for __builtin_{fmax,fmin}{f} without -ffinite-math-only. It is clear a compiler issue since the instruction can handle NaN and Inf correctly and GCC6+ does not show this issue. We backport a fix to GCC 5, raise the minimum required GCC version for aarch64 (since GCC 4.9 branch is now closed) and/or add configure check to check for this issue. However I think -ffinit-math-only should be safe for these specific implementation and it is a much simpler solution. Checked on aarch64-linux-gnu with GCC 5.3.1. * sysdeps/aarch64/fpu/Makefile (CFLAGS-s_fmax.c, CFLAGS-s_fmaxf.c, CFLAGS-s_fmin.c, CFLAGS-s_fminf.c): New rule: add -ffinite-math-only. [1] https://gcc.gnu.org/ml/gcc/2016-08/msg00010.html Signed-off-by: Adhemerval Zanella --- ChangeLog | 5 +++++ sysdeps/aarch64/fpu/Makefile | 6 ++++++ 2 files changed, 11 insertions(+) -- 2.7.4 diff --git a/sysdeps/aarch64/fpu/Makefile b/sysdeps/aarch64/fpu/Makefile index bf38f2c..4a182bd 100644 --- a/sysdeps/aarch64/fpu/Makefile +++ b/sysdeps/aarch64/fpu/Makefile @@ -5,4 +5,10 @@ CFLAGS-s_lroundf.c += -fno-math-errno CFLAGS-s_lround.c += -fno-math-errno CFLAGS-s_llroundf.c += -fno-math-errno CFLAGS-s_llround.c += -fno-math-errno +# GCC 4.9 and 5 requires the flag to correct emits a f{max,min}nm +# for a __builtin_{fmax,fmin}{f}. +CFLAGS-s_fmax.c += -ffinite-math-only +CFLAGS-s_fmaxf.c += -ffinite-math-only +CFLAGS-s_fmin.c += -ffinite-math-only +CFLAGS-s_fminf.c += -ffinite-math-only endif