[PATCH 10/13] s390: Use sqrt{f} builtin

Stefan Liebler stli@linux.ibm.com
Tue Jun 16 10:13:57 GMT 2020


On 6/10/20 5:59 PM, Adhemerval Zanella via Libc-alpha wrote:
> 
> 
> On 10/06/2020 12:45, Szabolcs Nagy wrote:
>> The 06/10/2020 17:39, Stefan Liebler via Libc-alpha wrote:
>>> Hi Adhemerval,
>>>
>>> my last tests with the sqrt builtin on s390x showed that gcc emits a
>>> call to libm which would lead to an infinite loop:
>>> if (x < 0)
>>>  sqrt(x)
>>> else
>>>  sqdbr-instruction
>>
>> in general the builtins based implementation
>> must be compiled with -fno-math-errno if
>> they have error conditions otherwise math-errno
>> may cause the compiler not to do a single
>> instruction inline like in this sqrt case.
> 
> Afaik libm is already build with -fno-math-errno with:
> 
> Makeconfig:849:+extra-math-flags = $(if $(filter libm,$(in-module)),-fno-math-errno,-fmath-errno)
> 
> And for some implementation (either default or compat ones)
> we have specific wrapper (for instance w_sqrt_*) to handle
> errno.
> 

Hi Adhemerval,

I've applied your patches and successfully run some test builds on
s390x/s390. Using the builtins for sqrt and sqrtf works fine.

This patch is okay.

Thanks,
Stefan


More information about the Libc-alpha mailing list