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

Sunil Pandey skpgkp2@gmail.com
Fri Mar 1 02:40:31 GMT 2024


On Thu, Feb 29, 2024 at 12:55 PM Richard Henderson <
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.

--Sunil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20240229/fb06a5f4/attachment.htm>


More information about the Libc-alpha mailing list