[PATCH v2 2/4] iee754: provide gcc builtins based generic fma functions

Vineet Gupta Vineet.Gupta1@synopsys.com
Tue Jun 2 17:13:42 GMT 2020


On 6/2/20 5:51 AM, Stefan Liebler via Libc-alpha wrote:
>  #endif /* math-use-builtins.h */
> Please also update the current architecture specific math-use-builtins.h
> file: sysdeps/s390/fpu/math-use-builtins.h
> Otherwise it will break build on s390x.

Done.

>> diff --git a/sysdeps/ieee754/dbl-64/s_fma.c b/sysdeps/ieee754/dbl-64/s_fma.c
>> index 876df6e78bdc..9dc5b132b9ee 100644
>> --- a/sysdeps/ieee754/dbl-64/s_fma.c
>> +++ b/sysdeps/ieee754/dbl-64/s_fma.c
>> @@ -25,6 +25,7 @@
>>  #include <fenv_private.h>
>>  #include <libm-alias-double.h>
>>  #include <tininess.h>
>> +#include <math-use-builtins.h>
>>
>>  /* This implementation uses rounding to odd to avoid problems with
>>     double rounding.  See a paper by Boldo and Melquiond:
>> @@ -33,6 +34,10 @@
>>  double
>>  __fma (double x, double y, double z)
>>  {
>> +#if USE_FMA_BUILTIN
>> +  return __builtin_fma (x, y, z);
>
> Architectures which have support for ldbl-128 will use the file
> sysdeps/ieee754/ldbl-128/s_fma.c instead of
> sysdeps/ieee754/dbl-64/s_fma.c. Should this file also be adjusted in
> order to use the builtin if USE_FMA_BUILTIN is set to one?

Right.

I used commit f82996f815 "Use GCC builtins for round functions if desired" as
starting point for my change. And seems it was not an ideal reference :-) as round
has far fewer instances than fma. Indeed fma is present in ldbl-128 and dbl-64 so
needs updating in both.

But just to be sure s390 is currently not using the newly introduced builtins so
I'll keep them as follows.

#define USE_SQRT_BUILTIN 0
#define USE_SQRTF_BUILTIN 0

#define USE_FMA_BUILTIN 0
#define USE_FMAF_BUILTIN 0
#define USE_FMAL_BUILTIN 0
#define USE_FMAF128_BUILTIN 0

-Vineet


More information about the Libc-alpha mailing list