This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 12/28] math: Use wordsize-64 version for isnan
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>, "Gabriel F. T. Gomes" <gabriel at inconstante dot eti dot br>
- Cc: nd <nd at arm dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Tue, 11 Jun 2019 18:04:27 -0300
- Subject: Re: [PATCH 12/28] math: Use wordsize-64 version for isnan
- References: <VI1PR0801MB2127E74D71040E911CFBA0C883ED0@VI1PR0801MB2127.eurprd08.prod.outlook.com>
On 11/06/2019 14:15, Wilco Dijkstra wrote:
> Hi Gabriel,
>
>> I don't actually understand what the impact on 32-bits platforms would
>> be, so I can't comment on that, but, if this patch turns out to be
>> problematic for 32-bits, we could patch sysdeps/ieee754/ldbl-opt files
>> to be mindful of __WORDSIZE and selectively include files from
>> sysdeps/ieee754/dbl-64 or sysdeps/ieee754/dbl-64/wordsize-64 (see
>> attached patch for an explanation of what I mean).
>
> I don't believe using simple masking, compares and fixed shifts can
> result in a noticeable difference on 32-bit targets. It could make a
> difference if it involves full 64-bit multiply, division or non-constant shift.
>
> However rather than making the already complex scheme even more
> complex, I would suggest to have if (WORDSIZE == 4) special paths
> if there are cases where it helps. That way we can merge all wordsize-64
> code into the generic variant and remove the wordsize-64 directories
> completely.
>
> Having only one variant of each function actually makes it reasonable to
> optimise it.
My take is math wordsize-64 was added to overcome some old compiler
deficiencies which most likely does not show any gain nowadays. Also,
specifically for isnan/isinf/isfinite I think multiple possible
optimization is a bit of over-engineering since the libc symbols will
be called with recent compiler only in very specific situations (most
likely not performance-wise).
What I would like to do is just uses wordsize-64 implementations as
default one and aim to provide specialized WORDSIZE paths if it really
provides a real gain.
So for this specific usage, isnan/isinf/isfinite, do you agree we can
just use wordsize-64 as default?