446cf2
commit 93fda28693f0d9060b0aa71eeacaacfe9f16896e
446cf2
Author: H.J. Lu <hjl.tools@gmail.com>
446cf2
Date:   Thu Dec 3 15:02:44 2020 -0800
446cf2
446cf2
    x86: Adjust tst-cpu-features-supports.c for GCC 11
446cf2
    
446cf2
    Check HAS_CPU_FEATURE instead of CPU_FEATURE_USABLE for FSGSBASE, IBT,
446cf2
    LM, SHSTK and XSAVES since FSGSBASE requires kernel support, IBT/SHSTK/LM
446cf2
    require OS support and XSAVES is supervisor-mode only.
446cf2
446cf2
diff --git a/sysdeps/x86/tst-cpu-features-supports.c b/sysdeps/x86/tst-cpu-features-supports.c
446cf2
index bf881b531f4bc2ed..287cf01fbdfaeda1 100644
446cf2
--- a/sysdeps/x86/tst-cpu-features-supports.c
446cf2
+++ b/sysdeps/x86/tst-cpu-features-supports.c
446cf2
@@ -40,6 +40,11 @@ check_supports (int supports, int usable, const char *supports_name,
446cf2
 #define CHECK_SUPPORTS(str, name) \
446cf2
   check_supports (__builtin_cpu_supports (#str), \
446cf2
 		  CPU_FEATURE_USABLE (name), \
446cf2
+		  #str, "CPU_FEATURE_USABLE (" #name ")");
446cf2
+
446cf2
+#define CHECK_CPU_SUPPORTS(str, name) \
446cf2
+  check_supports (__builtin_cpu_supports (#str), \
446cf2
+		  HAS_CPU_FEATURE (name), \
446cf2
 		  #str, "HAS_CPU_FEATURE (" #name ")");
446cf2
 
446cf2
 static int
446cf2
@@ -118,7 +123,7 @@ do_test (int argc, char **argv)
446cf2
   fails += CHECK_SUPPORTS (fma4, FMA4);
446cf2
 #endif
446cf2
 #if __GNUC_PREREQ (11, 0)
446cf2
-  fails += CHECK_SUPPORTS (fsgsbase, FSGSBASE);
446cf2
+  fails += CHECK_CPU_SUPPORTS (fsgsbase, FSGSBASE);
446cf2
   fails += CHECK_SUPPORTS (fxsave, FXSR);
446cf2
 #endif
446cf2
 #if __GNUC_PREREQ (8, 0)
446cf2
@@ -126,9 +131,9 @@ do_test (int argc, char **argv)
446cf2
 #endif
446cf2
 #if __GNUC_PREREQ (11, 0)
446cf2
   fails += CHECK_SUPPORTS (hle, HLE);
446cf2
-  fails += CHECK_SUPPORTS (ibt, IBT);
446cf2
+  fails += CHECK_CPU_SUPPORTS (ibt, IBT);
446cf2
   fails += CHECK_SUPPORTS (lahf_lm, LAHF64_SAHF64);
446cf2
-  fails += CHECK_SUPPORTS (lm, LM);
446cf2
+  fails += CHECK_CPU_SUPPORTS (lm, LM);
446cf2
   fails += CHECK_SUPPORTS (lwp, LWP);
446cf2
   fails += CHECK_SUPPORTS (lzcnt, LZCNT);
446cf2
 #endif
446cf2
@@ -150,7 +155,7 @@ do_test (int argc, char **argv)
446cf2
   fails += CHECK_SUPPORTS (rtm, RTM);
446cf2
   fails += CHECK_SUPPORTS (serialize, SERIALIZE);
446cf2
   fails += CHECK_SUPPORTS (sha, SHA);
446cf2
-  fails += CHECK_SUPPORTS (shstk, SHSTK);
446cf2
+  fails += CHECK_CPU_SUPPORTS (shstk, SHSTK);
446cf2
 #endif
446cf2
   fails += CHECK_SUPPORTS (sse, SSE);
446cf2
   fails += CHECK_SUPPORTS (sse2, SSE2);
446cf2
@@ -180,7 +185,7 @@ do_test (int argc, char **argv)
446cf2
   fails += CHECK_SUPPORTS (xsave, XSAVE);
446cf2
   fails += CHECK_SUPPORTS (xsavec, XSAVEC);
446cf2
   fails += CHECK_SUPPORTS (xsaveopt, XSAVEOPT);
446cf2
-  fails += CHECK_SUPPORTS (xsaves, XSAVES);
446cf2
+  fails += CHECK_CPU_SUPPORTS (xsaves, XSAVES);
446cf2
 #endif
446cf2
 
446cf2
   printf ("%d differences between __builtin_cpu_supports and glibc code.\n",