This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 1/6] ldbl-128: Simplify fma usage
On Wed, 17 Aug 2016, Paul E. Murphy wrote:
> +#ifndef _MUL_SPLIT_H
> +#define _MUL_SPLIT_H
> +
> +#include <float.h>
> +
> +/* Choose an appropriate fused multiply-add function, if any. */
> +#ifdef __FP_FAST_FMA
> +# define __FMA __builtin_fma
> +#elif defined FP_FAST_FMA
> +# define __FMA __fma
> +#endif
By testing FP_FAST_FMA here, this header has a nonobvious dependency on
include ordering: it would quietly behave differently if <math.h>, the
header that defines FP_FAST_FMA, were not included first. Such a
nonobvious quiet dependency is a bad idea; either this header (and
likewise the one for long double) should include <math.h>, or the tests of
FP_FAST_FMA and FP_FAST_FMAL should be removed as no longer relevant now
we require GCC versions recent enough to have built-in fma and predefine
__FP_FAST_FMA when a fast inline expansion is available.
(The bug is of course theoretical, since (a) the include ordering in the
patch is correct and (b) the #elif case is dead code because of the
compiler version requirements. But we shouldn't introduce headers that
look suspicious like that.)
--
Joseph S. Myers
joseph@codesourcery.com