From 7961c445f27de3e813d7332afc14e9844c0831f7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 24 Jun 2021 04:43:41 -0700 Subject: [PATCH v2] x86: Check AVX512 without mask instructions CPUID functions are used to detect CPU features. If mask instructions are enabled, compiler is free to use them in these functions. Disable AVX512F in AVX512 check with target pragma to avoid mask instructions. PR target/101185 * gcc.target/i386/avx512-check.h: Disable AVX512F in AVX512 check with target pragma. --- gcc/testsuite/gcc.target/i386/avx512-check.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gcc/testsuite/gcc.target/i386/avx512-check.h b/gcc/testsuite/gcc.target/i386/avx512-check.h index 0a377dba1d5..7ccf730c4f1 100644 --- a/gcc/testsuite/gcc.target/i386/avx512-check.h +++ b/gcc/testsuite/gcc.target/i386/avx512-check.h @@ -1,5 +1,8 @@ #include +#pragma GCC push_options +#pragma GCC target ("no-mmx,no-sse") #include "cpuid.h" +#pragma GCC pop_options #include "m512-check.h" #include "avx512f-os-support.h" @@ -25,6 +28,9 @@ do_test (void) } #endif +#pragma GCC push_options +#pragma GCC target ("no-mmx,no-sse") + static int check_osxsave (void) { @@ -110,3 +116,4 @@ main () #endif return 0; } +#pragma GCC pop_options -- 2.31.1