aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuhongt <hongtao.liu@intel.com>2024-07-03 14:47:33 +0800
committerliuhongt <hongtao.liu@intel.com>2024-07-03 15:27:00 +0800
commit239ad907b1fc08874042f8bea5f61eaf3ba2877d (patch)
treeaef19400e6651a8b9a79c8c0df00511554aa1953
parentab3e3d2f0564c2eb0640de3f4d0a50e1fcc8c318 (diff)
downloadgcc-239ad907b1fc08874042f8bea5f61eaf3ba2877d.zip
gcc-239ad907b1fc08874042f8bea5f61eaf3ba2877d.tar.gz
gcc-239ad907b1fc08874042f8bea5f61eaf3ba2877d.tar.bz2
Move runtime check into a separate function and guard it with target ("no-avx")
The patch can avoid SIGILL on non-AVX512 machine due to kmovd is generated in dynamic check. gcc/testsuite/ChangeLog: PR target/115748 * gcc.target/i386/avx512-check.h: Move runtime check into a separate function and guard it with target ("no-avx").
-rw-r--r--gcc/testsuite/gcc.target/i386/avx512-check.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.target/i386/avx512-check.h b/gcc/testsuite/gcc.target/i386/avx512-check.h
index 0ad9064..71858a3 100644
--- a/gcc/testsuite/gcc.target/i386/avx512-check.h
+++ b/gcc/testsuite/gcc.target/i386/avx512-check.h
@@ -34,8 +34,9 @@ check_osxsave (void)
return (ecx & bit_OSXSAVE) != 0;
}
+__attribute__((noipa,target("no-avx")))
int
-main ()
+avx512_runtime_support_p ()
{
unsigned int eax, ebx, ecx, edx;
@@ -101,6 +102,17 @@ main ()
#endif
&& avx512f_os_support ())
{
+ return 1;
+ }
+
+ return 0;
+}
+
+int
+main ()
+{
+ if (avx512_runtime_support_p ())
+ {
DO_TEST ();
#ifdef DEBUG
printf ("PASSED\n");