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