This is the mail archive of the
libc-alpha@sourceware.org
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:
https://sourceware.org/ml/libc-alpha/2015-12/msg00041.html
..so all that is generated is a load followed by a masking operation:
bergner@pike:~$ cat float128.c
int
float128 (void)
{
return __builtin_cpu_supports ("ieee128");
}
bergner@pike:~$ gcc -O2 -S float128.c
bergner@pike:~$ cat float128.s
[snip]
float128:
lwz 3,-28776(13)
rldicl 3,3,42,63
blr
Peter