From: Ulrich Drepper Date: Tue, 25 Oct 2011 02:11:21 +0000 (-0400) Subject: Better DLA_FMS X-Git-Tag: glibc-2.15~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=202c9deb15ee43bcbe70b36fa9bae050b8633c27;p=thirdparty%2Fglibc.git Better DLA_FMS It's better to use __builtin_fma if it works. Use it for gcc 4.6 and higher. Move the x86-64 dla.h to the correct place. --- diff --git a/ChangeLog b/ChangeLog index 108d9a96c38..992ad4cb2ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ 2011-10-24 Ulrich Drepper - * sysdeps/x86_64/dla.h (DLA_FMS): Some compilers fail to inline - __builtin_fma in some situations. Have to use an asm. + * sysdeps/x86_64/dla.h: Move to ... + * sysdeps/x86_64/fpu/dla.h: ...here. + (DLA_FMS): Some compilers fail to inline __builtin_fma in some + situations. Use __builtin_fma only for gcc 4.6 and up. * config.make.in: Add have-mfma4 entry. * configure.in: Substitute libc_cv_cc_fma4. diff --git a/sysdeps/x86_64/dla.h b/sysdeps/x86_64/fpu/dla.h similarity index 63% rename from sysdeps/x86_64/dla.h rename to sysdeps/x86_64/fpu/dla.h index 6fe8f740f35..fa2d52bbf0c 100644 --- a/sysdeps/x86_64/dla.h +++ b/sysdeps/x86_64/fpu/dla.h @@ -1,10 +1,17 @@ +#include + #ifdef __FMA4__ -# define DLA_FMS(x,y,z) \ +# if __GNUC_PREREQ (4, 6) +# define DLA_FMS(x,y,z) \ + __builtin_fma (x, y, -(z)) +# else +# define DLA_FMS(x,y,z) \ ({ double __z; \ asm ("vfmsubsd %3, %2, %1, %0" \ : "=x" (__z) \ : "x" ((double) (x)), "xm" ((double) (y)) , "x" ((double) (z))); \ __z; }) +# endif #endif #include "sysdeps/ieee754/dbl-64/dla.h"