[PATCH] AArch64: Optimise SVE scalar callbacks

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Sep 22 16:27:19 GMT 2025



On 22/09/25 13:17, Florian Weimer wrote:
> * Joe Ramsay:
> 
>> Instead of using SVE instructions to marshall special results into the
>> correct lane, just write the entire vector (and the predicate) to
>> memory, then use cheaper scalar operations.
>>
>> -fno-stack-protector is added to the CFLAGS for SVE routines, as the
>> fallbacks incur a small stack allocation. sv_call_* allocates VL + VL
>> / 8 bytes, and sv_call2_* allocates 2 * VL + VL / 8, where VL is the
>> SVE vector length in bytes. The maximum VL is 256, so the largest
>> possible stack allocation from the new handlers is 544 bytes.
> 
> Can you use fixed-size arrays instead? (I assume you currently use
> VLAs.)  If you are worried about the -fstack-protector-strong impact,
> -fstack-clash-protection might be worse for a VLA.
> 
> (I expect that most distributions build glibc with -fstack-clash-protection.)

I also think we need to be judicious about overriding stack hardening. We
do it on some startup routines due correctness (since the code can not use
stack hardening at the moment); but for optimization I think we should use
what compiler is using by default.


More information about the Libc-alpha mailing list