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 Netto X-Patchwork-Id: 24304 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-Google-Smtp-Source: AGs4zMbe00ZZoxh+elhD7l8ajT5tDS66IfJZX8wMtijY+ekiIHU+64aO/0/+kAzfbZOKornZyNkadw== 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(+) 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