public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] x86-64: Simplify minimum ISA check ifdef conditional with if
@ 2024-03-04  0:14 Sunil Pandey
  0 siblings, 0 replies; only message in thread
From: Sunil Pandey @ 2024-03-04  0:14 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b6e3898194bbae78910bbe9cd086937014961e45

commit b6e3898194bbae78910bbe9cd086937014961e45
Author: Sunil K Pandey <skpgkp2@gmail.com>
Date:   Thu Feb 29 17:57:02 2024 -0800

    x86-64: Simplify minimum ISA check ifdef conditional with if
    
    Replace minimum ISA check ifdef conditional with if.  Since
    MINIMUM_X86_ISA_LEVEL and AVX_X86_ISA_LEVEL are compile time constants,
    compiler will perform constant folding optimization, getting same
    results.
    
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Diff:
---
 sysdeps/x86/cpu-features.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/sysdeps/x86/cpu-features.c b/sysdeps/x86/cpu-features.c
index e7c7ece462..4ea373dffa 100644
--- a/sysdeps/x86/cpu-features.c
+++ b/sysdeps/x86/cpu-features.c
@@ -1196,9 +1196,8 @@ 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 (MINIMUM_X86_ISA_LEVEL >= AVX_X86_ISA_LEVEL
+      || (GLRO(dl_x86_cpu_features).xsave_state_size != 0))
     {
       if (CPU_FEATURE_USABLE_P (cpu_features, XSAVEC))
 	{
@@ -1219,24 +1218,22 @@ no_cpuid:
 #endif
 	}
     }
-#if MINIMUM_X86_ISA_LEVEL < AVX_X86_ISA_LEVEL
   else
     {
-# ifdef __x86_64__
+#ifdef __x86_64__
       GLRO(dl_x86_64_runtime_resolve) = _dl_runtime_resolve_fxsave;
-#  ifdef SHARED
+# ifdef SHARED
       GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fxsave;
-#  endif
-# else
-#  ifdef SHARED
+# endif
+#else
+# ifdef SHARED
       if (CPU_FEATURE_USABLE_P (cpu_features, FXSR))
 	GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fxsave;
       else
 	GLRO(dl_x86_tlsdesc_dynamic) = _dl_tlsdesc_dynamic_fnsave;
-#  endif
 # endif
-    }
 #endif
+    }
 
 #ifdef SHARED
 # ifdef __x86_64__

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-04  0:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-04  0:14 [glibc] x86-64: Simplify minimum ISA check ifdef conditional with if Sunil Pandey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).