https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119617
--- Comment #9 from Haochen Jiang <haochen.jiang at intel dot com> ---
Proposed change:
diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index a9fac011f3d..789c1f1ae54 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -2775,6 +2775,12 @@ ix86_option_override_internal (bool main_args_p,
opts->x_ix86_isa_flags2 |= avx512_isa_flags2;
}
+ /* Reject -mno-evex512 if AVX512VL is not enabled. */
+ if (!TARGET_EVEX512_P (opts->x_ix86_isa_flags2)
+ && (OPTION_MASK_ISA2_EVEX512 & opts->x_ix86_isa_flags2_explicit)
+ && !TARGET_AVX512VL_P (opts->x_ix86_isa_flags))
+ error ("%<-mno-evex512%> could not be used if AVX512VL is not enabled");
+
/* Validate -mpreferred-stack-boundary= value or default it to
PREFERRED_STACK_BOUNDARY_DEFAULT. */
ix86_preferred_stack_boundary = PREFERRED_STACK_BOUNDARY_DEFAULT;