]> sourceware.org Git - glibc.git/commitdiff
aarch64: Fix f{max,min}{f} build for GCC 4.9 and 5
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 16 Nov 2017 21:52:59 +0000 (19:52 -0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 17 Nov 2017 11:23:07 +0000 (09:23 -0200)
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 can backport a fix to GCC 5, raise the minimum required GCC version
for aarch64 (since GCC 4.9 branch is now closed [1]) and/or add
configure check to check for this issue.  However I think
-ffinite-math-only should be safe for these specific implementations
and it is a 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 <adhemerval.zanella@linaro.org>
Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
ChangeLog
sysdeps/aarch64/fpu/Makefile

index 0d5998f67c7f7e5c918c13279b7d47c0ba028771..81b71a5a0eec263e67e3cc7730e518df93ec68a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-11-16  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
+
+       * 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.
+
 2017-11-16  Joseph Myers  <joseph@codesourcery.com>
 
        * sysdeps/unix/sysv/linux/net/if_arp.h (ARPHRD_RAWIP): New macro.
index bf38f2c589e96a1b3d098f26c3eb334d519b9acc..4a182bd6d6886387816e97128524957504e37595 100644 (file)
@@ -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
This page took 0.079296 seconds and 5 git commands to generate.