]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
x86-64: Simplify minimum ISA check ifdef conditional with if
authorSunil K Pandey <skpgkp2@gmail.com>
Fri, 1 Mar 2024 01:57:02 +0000 (17:57 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 17 Oct 2025 00:04:37 +0000 (08:04 +0800)
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>
(cherry picked from commit b6e3898194bbae78910bbe9cd086937014961e45)

sysdeps/x86/cpu-features.c

index 051d8c2536971a4e7bfe033c1b6d3bbc6eaa60ed..4570d3d075ddb97307008740e87c534343087aaf 100644 (file)
@@ -1117,9 +1117,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))
        {
@@ -1140,24 +1139,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
+    }
 
 #ifndef SHARED
   /* NB: In libc.a, call init_cacheinfo.  */