This is the mail archive of the libc-alpha@sourceware.org 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 12/28] math: Use wordsize-64 version for isnan



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?


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