From: liuhongt Date: Wed, 16 Sep 2020 05:56:30 +0000 (+0800) Subject: If -mavx implies -mxsave, then -mno-xsave should imply -mno-avx. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a8c4b66a41fa805757f5943bd41690243365bccd;p=gcc.git If -mavx implies -mxsave, then -mno-xsave should imply -mno-avx. Current status is -mno-avx implies -mno-xsave which should be wrong. gcc/ChangeLog * common/config/i386/i386-common.c (OPTION_MASK_ISA_AVX_UNSET): Remove OPTION_MASK_ISA_XSAVE_UNSET. (OPTION_MASK_ISA_XSAVE_UNSET): Add OPTION_MASK_ISA_AVX_UNSET. gcc/testsuite/ChangeLog * gcc.target/i386/xsave-avx-1.c: New test. --- diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c index 5305145a8c9..6e3409556fb 100644 --- a/gcc/common/config/i386/i386-common.c +++ b/gcc/common/config/i386/i386-common.c @@ -187,12 +187,13 @@ along with GCC; see the file COPYING3. If not see #define OPTION_MASK_ISA_AVX_UNSET \ (OPTION_MASK_ISA_AVX | OPTION_MASK_ISA_FMA_UNSET \ | OPTION_MASK_ISA_FMA4_UNSET | OPTION_MASK_ISA_F16C_UNSET \ - | OPTION_MASK_ISA_AVX2_UNSET | OPTION_MASK_ISA_XSAVE_UNSET) + | OPTION_MASK_ISA_AVX2_UNSET ) #define OPTION_MASK_ISA_FMA_UNSET OPTION_MASK_ISA_FMA #define OPTION_MASK_ISA_FXSR_UNSET OPTION_MASK_ISA_FXSR #define OPTION_MASK_ISA_XSAVE_UNSET \ (OPTION_MASK_ISA_XSAVE | OPTION_MASK_ISA_XSAVEOPT_UNSET \ - | OPTION_MASK_ISA_XSAVES_UNSET | OPTION_MASK_ISA_XSAVEC_UNSET) + | OPTION_MASK_ISA_XSAVES_UNSET | OPTION_MASK_ISA_XSAVEC_UNSET \ + | OPTION_MASK_ISA_AVX_UNSET) #define OPTION_MASK_ISA_XSAVEOPT_UNSET OPTION_MASK_ISA_XSAVEOPT #define OPTION_MASK_ISA_AVX2_UNSET \ (OPTION_MASK_ISA_AVX2 | OPTION_MASK_ISA_AVX512F_UNSET) diff --git a/gcc/testsuite/gcc.target/i386/xsave-avx-1.c b/gcc/testsuite/gcc.target/i386/xsave-avx-1.c new file mode 100644 index 00000000000..ca87a791446 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/xsave-avx-1.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-mxsave -mno-avx" } */ + +#include + +extern int m; + +void +avx_imply_save (void) +{ + _xgetbv (m); +}