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