public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] x86: Adjust tst-cpu-features-supports.c for GCC 11
@ 2020-12-04 13:14 H.J. Lu
0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2020-12-04 13:14 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=93fda28693f0d9060b0aa71eeacaacfe9f16896e
commit 93fda28693f0d9060b0aa71eeacaacfe9f16896e
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Thu Dec 3 15:02:44 2020 -0800
x86: Adjust tst-cpu-features-supports.c for GCC 11
Check HAS_CPU_FEATURE instead of CPU_FEATURE_USABLE for FSGSBASE, IBT,
LM, SHSTK and XSAVES since FSGSBASE requires kernel support, IBT/SHSTK/LM
require OS support and XSAVES is supervisor-mode only.
Diff:
---
sysdeps/x86/tst-cpu-features-supports.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/sysdeps/x86/tst-cpu-features-supports.c b/sysdeps/x86/tst-cpu-features-supports.c
index bf881b531f..287cf01fbd 100644
--- a/sysdeps/x86/tst-cpu-features-supports.c
+++ b/sysdeps/x86/tst-cpu-features-supports.c
@@ -40,6 +40,11 @@ check_supports (int supports, int usable, const char *supports_name,
#define CHECK_SUPPORTS(str, name) \
check_supports (__builtin_cpu_supports (#str), \
CPU_FEATURE_USABLE (name), \
+ #str, "CPU_FEATURE_USABLE (" #name ")");
+
+#define CHECK_CPU_SUPPORTS(str, name) \
+ check_supports (__builtin_cpu_supports (#str), \
+ HAS_CPU_FEATURE (name), \
#str, "HAS_CPU_FEATURE (" #name ")");
static int
@@ -118,7 +123,7 @@ do_test (int argc, char **argv)
fails += CHECK_SUPPORTS (fma4, FMA4);
#endif
#if __GNUC_PREREQ (11, 0)
- fails += CHECK_SUPPORTS (fsgsbase, FSGSBASE);
+ fails += CHECK_CPU_SUPPORTS (fsgsbase, FSGSBASE);
fails += CHECK_SUPPORTS (fxsave, FXSR);
#endif
#if __GNUC_PREREQ (8, 0)
@@ -126,9 +131,9 @@ do_test (int argc, char **argv)
#endif
#if __GNUC_PREREQ (11, 0)
fails += CHECK_SUPPORTS (hle, HLE);
- fails += CHECK_SUPPORTS (ibt, IBT);
+ fails += CHECK_CPU_SUPPORTS (ibt, IBT);
fails += CHECK_SUPPORTS (lahf_lm, LAHF64_SAHF64);
- fails += CHECK_SUPPORTS (lm, LM);
+ fails += CHECK_CPU_SUPPORTS (lm, LM);
fails += CHECK_SUPPORTS (lwp, LWP);
fails += CHECK_SUPPORTS (lzcnt, LZCNT);
#endif
@@ -150,7 +155,7 @@ do_test (int argc, char **argv)
fails += CHECK_SUPPORTS (rtm, RTM);
fails += CHECK_SUPPORTS (serialize, SERIALIZE);
fails += CHECK_SUPPORTS (sha, SHA);
- fails += CHECK_SUPPORTS (shstk, SHSTK);
+ fails += CHECK_CPU_SUPPORTS (shstk, SHSTK);
#endif
fails += CHECK_SUPPORTS (sse, SSE);
fails += CHECK_SUPPORTS (sse2, SSE2);
@@ -180,7 +185,7 @@ do_test (int argc, char **argv)
fails += CHECK_SUPPORTS (xsave, XSAVE);
fails += CHECK_SUPPORTS (xsavec, XSAVEC);
fails += CHECK_SUPPORTS (xsaveopt, XSAVEOPT);
- fails += CHECK_SUPPORTS (xsaves, XSAVES);
+ fails += CHECK_CPU_SUPPORTS (xsaves, XSAVES);
#endif
printf ("%d differences between __builtin_cpu_supports and glibc code.\n",
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-04 13:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 13:14 [glibc] x86: Adjust tst-cpu-features-supports.c for GCC 11 H.J. Lu
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).