On Wed, Aug 23, 2023 at 4:31 PM Jakub Jelinek <ja...@redhat.com> wrote: > > On Wed, Aug 23, 2023 at 08:03:58AM +0000, Jiang, Haochen wrote: > > We could first work on -mevex512 then further discuss -mavx10.1-256/512 > > since > > these -mavx10.1-256/512 is quite controversial. > > > > Just to clarify, -mno-evex512 -mavx512f should not enable 512 bit vector > > right? > > I think it should enable them because -mavx512f is after it. But it seems the > option handling is more complex than I thought, e.g. -mavx512bw -mno-avx512bw > just cancels each other, rather than > enabling AVX512BW, AVX512F, AVX2 and all its dependencies (like -mavx512bw > alone does) and then just disabling AVX512BW (like -mno-avx512bw does). > But, if one uses separate target pragmas, it behaves like that: > #pragma GCC target ("avx512bw") > #ifdef __AVX512F__ > int a; > #endif > #ifdef __AVX512BW__ > int b; > #endif > #pragma GCC target ("no-avx512bw") > #ifdef __AVX512F__ > int c; > #endif > #ifdef __AVX512BW__ > int d; > #endif > The above defines a, b and c vars even without any special -march= or other > command line option. > > So, first important decision would be whether to make EVEX512 > OPTION_MASK_ISA_EVEX512 or OPTION_MASK_ISA2_EVEX512, the former would need > to move some other ISA flag from the first to second set. > That OPTION_MASK_ISA*_EVEX512 then should be added to > OPTION_MASK_ISA_AVX512F_SET or OPTION_MASK_ISA2_AVX512F_SET (but, if it is > the latter, we also need to do that for tons of other AVX512*_SET), > and then just arrange for -mavx10.1-256 to enable > OPTION_MASK_ISA*_AVX512*_SET of everything it needs except the EVEX512 set > (but, only disable it from the newly added set, not actually act as > -mavx512{f,bw,...} -mno-evex512). > OPTION_MASK_ISA*_EVEX512_SET dunno, should it enable OPTION_MASK_ISA_AVX512F > or just EVEX512? > And then the UNSET cases... We can make OPTION_MASK_ISA2_EVEX512, but not set/unset that in ix86_handle_option, but in ix86_option_override_internal, after all set/unset for the existing AVX512***, if there's still OPTION_MASK_ISA_AVX512F and no explicit set/unset for OPTION_MASK_ISA2_EVEX512, then we set OPTION_MASK_ISA2_EVEX512. That would make -mavx512*** implicitly set -mevex-512, but when there's explicit -mno-evex512, -mavx512f won't set -mevex512 no matter where -mno-evex512 is put.(-mno-evex512 -mavx512f still disable 512-bit). > > Jakub >
-- BR, Hongtao