This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 7/7] powerpc64le: Enable float128

* Peter Bergner:

> 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:
> 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

Nice.  I guess the next question is: what would ensure that this code
only runs on a glibc which sets up the TCB in the expected way?  Is
there a symbol reference which prevents that?

__parse_hwcap_and_convert_at_platform isn't that symbol, as far as I
can tell.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]