[PATCH] x86-64: Don't use SSE resolvers for ISA level 3 or above

Richard Henderson richard.henderson@linaro.org
Fri Mar 1 22:22:57 GMT 2024


On 2/29/24 16:40, Sunil Pandey wrote:
> 
> 
> On Thu, Feb 29, 2024 at 12:55 PM Richard Henderson <richard.henderson@linaro.org 
> <mailto:richard.henderson@linaro.org>> wrote:
> 
>     On 2/28/24 07:51, H.J. Lu wrote:
>      > --- a/sysdeps/x86/cpu-features.c
>      > +++ b/sysdeps/x86/cpu-features.c
>      > @@ -18,6 +18,7 @@
>      >
>      >   #include <dl-hwcap.h>
>      >   #include <libc-pointer-arith.h>
>      > +#include <isa-level.h>
>      >   #include <get-isa-level.h>
>      >   #include <cacheinfo.h>
>      >   #include <dl-cacheinfo.h>
>      > @@ -1195,7 +1196,9 @@ no_cpuid:
>      >              TUNABLE_CALLBACK (set_x86_shstk));
>      >   #endif
>      >
>      > +#if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL
>      >     if (GLRO(dl_x86_cpu_features).xsave_state_size != 0)
>      > +#endif
>      >       {
>      >         if (CPU_FEATURE_USABLE_P (cpu_features, XSAVEC))
>      >       {
> 
>     Surely this can be written with IF and not IFDEF:
> 
>         if (MINIMUM_X86_ISA_LEVEL >= AVX_X86_ISA_LEVEL
>             || GLRO(dl_x86_cpu_features).xsave_state_size != 0)
> 
> 
> For sure it can be written like IF, but using IFDEF has the following perf and code size 
> advantage.
> 
> For MINIMUM_X86_ISA_LEVEL >= AVX_X86_ISA_LEVEL case
> 
> it will remove conditional
> 
> if (GLRO(dl_x86_cpu_features).xsave_state_size != 0)
> 
> and else block code of this conditional during preprocessing.

You miss the point -- both of these are constants and will be folded by the compiler. 
There is no perf or code size advantage for cpp.


r~


More information about the Libc-alpha mailing list