math: Improve layout of expf data

Alexander Monakov amonakov@ispras.ru
Tue Jul 30 13:56:32 GMT 2024


On Tue, 30 Jul 2024, Wilco Dijkstra wrote:

> Hi Alexander,
> 
> > I cannot tell which fields are supposed to be aligned after your patch
> > (neither from your text, nor from the diff itself). I also don't see
> > how alignment would change, considering the struct itself carries no
> > additional alignment attribute.
> 
> GCC aligns global data to 16 bytes if their size is >= 16 bytes. The patch changes
> the struct slightly so that both load pair instructions below are 16-byte aligned
> (and thus avoid cacheline and page cross penalties).

I see, thank you, exp2f accesses invln2_scaled and poly_scaled[0..2] and so it's
nicer if they have offset 16*k in the struct. For exp2f there's no change (it
uses shift_scaled and poly[0..2]) and for exp10f it makes the accesses
contiguous (uses shift and poly_scaled[0..2]).

Would have been nice to have the explanation in the commit message.

Cheers.
Alexander


More information about the Libc-alpha mailing list