]> git.ipfire.org Git - thirdparty/gcc.git/commit
i386: Share AES xmm intrin with VAES
authorHaochen Jiang <haochen.jiang@intel.com>
Fri, 10 Mar 2023 05:40:09 +0000 (13:40 +0800)
committerHaochen Jiang <haochen.jiang@intel.com>
Thu, 20 Apr 2023 01:34:03 +0000 (09:34 +0800)
commit24a8acc1662c37003a7b54814bf840019fec2190
treed0bc7ea8acc182201217ce7cd6e402c22f96a136
parentca3bd377c7eae2ece01a1bb686a920daad179a89
i386: Share AES xmm intrin with VAES

Currently in GCC, the 128 bit intrin for instruction vaes{end,dec}{last,}
is under AES ISA. Because there is no dependency between ISA set AES
and VAES, The 128 bit intrin is not available when we use compiler flag
-mvaes -mavx512vl and there is no other way to use that intrin. But it
should according to Intel SDM.

Although VAES aims to be a VEX/EVEX promotion for AES, but it is only part
of it. Therefore, we share the AES xmm intrin with VAES.

Also, since -mvaes indicates that we could use VEX encoding for ymm, we
should imply AVX for VAES.

gcc/ChangeLog:

* common/config/i386/i386-common.cc
(OPTION_MASK_ISA2_AVX_UNSET): Add OPTION_MASK_ISA2_VAES_UNSET.
(ix86_handle_option): Set AVX flag for VAES.
* config/i386/i386-builtins.cc (ix86_init_mmx_sse_builtins):
Add OPTION_MASK_ISA2_VAES_UNSET.
(def_builtin): Share builtin between AES and VAES.
* config/i386/i386-expand.cc (ix86_check_builtin_isa_match):
Ditto.
* config/i386/i386.md (aes): New isa attribute.
* config/i386/sse.md (aesenc): Add pattern for VAES with xmm.
(aesenclast): Ditto.
(aesdec): Ditto.
(aesdeclast): Ditto.
* config/i386/vaesintrin.h: Remove redundant avx target push.
* config/i386/wmmintrin.h (_mm_aesdec_si128): Change to macro.
(_mm_aesdeclast_si128): Ditto.
(_mm_aesenc_si128): Ditto.
(_mm_aesenclast_si128): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/i386/avx512fvl-vaes-1.c: Add VAES xmm test.
* gcc.target/i386/pr109117-1.c: Modify error message.
gcc/common/config/i386/i386-common.cc
gcc/config/i386/i386-builtins.cc
gcc/config/i386/i386-expand.cc
gcc/config/i386/i386.md
gcc/config/i386/sse.md
gcc/config/i386/vaesintrin.h
gcc/config/i386/wmmintrin.h
gcc/testsuite/gcc.target/i386/avx512fvl-vaes-1.c
gcc/testsuite/gcc.target/i386/pr109117-1.c