This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH v3 7/7] powerpc64le: Enable float128
On 6/27/17 1:42 PM, Florian Weimer wrote:
> On 06/27/2017 05:00 PM, Peter Bergner wrote:
>> We have a __builtin_cpu_supports() version that can test for float128, so
>> why can't we use the following? On older systems (ie, older glibcs),
>> the builtin will expand to false, which is conservatively correct.
>> +#define SW_OR_HW(SW, HW) (__builtin_cpu_supports ("ieee128") ? HW : SW)
> How is that implemented? Does it call into the kernel or glibc, too?
No. It reads a bit mask stored in the TCB which glibc has initialized
for us long before main() is called:
..so all that is generated is a load followed by a masking operation:
bergner@pike:~$ cat float128.c
return __builtin_cpu_supports ("ieee128");
bergner@pike:~$ gcc -O2 -S float128.c
bergner@pike:~$ cat float128.s