Support Intel AVX VNNI
authorliuhongt <hongtao.liu@intel.com>
Tue, 10 Nov 2020 05:01:32 +0000 (13:01 +0800)
committerliuhongt <hongtao.liu@intel.com>
Wed, 11 Nov 2020 11:09:50 +0000 (19:09 +0800)
commitca813880dcaae71f664d8f386b1a584cfefbbd4b
tree47ec102bf7a2cfecbf5c7c007640bd04244e3baa
parentfbb3e275ab0ddbe1413b7f18fc25249fdb46a275
Support Intel AVX VNNI

2020-10-13  Hongtao Liu  <hongtao.liu@intel.com>
    Hongyu Wang  <hongyu.wang@intel.com>

gcc/
* common/config/i386/cpuinfo.h (get_available_features):
Detect AVXVNNI.
* common/config/i386/i386-common.c
(OPTION_MASK_ISA2_AVXVNNI_SET,
OPTION_MASK_ISA2_AVXVNNI_UNSET): New.
(OPTION_MASK_ISA2_AVX2_UNSET): Add AVXVNNI.
(ix86_hanlde_option): Handle -mavxvnni, unset avxvnni when
avx2 is disabled.
* common/config/i386/i386-cpuinfo.h (enum processor_features):
Add FEATURE_AVXVNNI.
* common/config/i386/i386-isas.h: Add ISA_NAMES_TABLE_ENTRY
for avxvnni.
* config.gcc: Add avxvnniintrin.h.
* config/i386/avx512vnnivlintrin.h: Reimplement 128/256 bit non-mask
intrinsics with macros to support unified interface.
* config/i386/avxvnniintrin.h: New header file.
* config/i386/cpuid.h (bit_AVXVNNI): New.
* config/i386/i386-builtins.c (def_builtin): Handle AVXVNNI mask
for unified builtin.
* config/i386/i386-builtin.def (BDESC): Adjust AVX512VNNI
builtins for AVXVNNI.
* config/i386/i386-c.c (ix86_target_macros_internal): Define
__AVXVNNI__.
* config/i386/i386-expand.c (ix86_expand_builtin): Handle bisa
for AVXVNNI to support unified intrinsic name, since there is no
dependency between AVX512VNNI and AVXVNNI.
* config/i386/i386-options.c (isa2_opts): Add -mavxvnni.
(ix86_valid_target_attribute_inner_p): Handle avxnnni.
(ix86_option_override_internal): Ditto.
* config/i386/i386.h (TARGET_AVXVNNI, TARGET_AVXVNNI_P,
TARGET_AVXVNNI_P, PTA_AVXVNNI): New.
(PTA_SAPPHIRERAPIDS): Add AVX_VNNI.
(PTA_ALDERLAKE): Likewise.
* config/i386/i386.md ("isa"): Add avxvnni, avx512vnnivl.
("enabled"): Adjust for avxvnni and avx512vnnivl.
* config/i386/i386.opt: Add option -mavxvnni.
* config/i386/immintrin.h: Include avxvnniintrin.h.
* config/i386/sse.md (vpdpbusd_<mode>): Adjust for AVXVNNI.
(vpdpbusds_<mode>): Likewise.
(vpdpwssd_<mode>): Likewise.
(vpdpwssds_<mode>): Likewise.
(vpdpbusd_v16si): New.
(vpdpbusds_v16si): Likewise.
(vpdpwssd_v16si): Likewise.
(vpdpwssds_v16si): Likewise.
* doc/invoke.texi: Document -mavxvnni.
* doc/extend.texi: Document avxvnni.
* doc/sourcebuild.texi: Document target avxvnni.

gcc/testsuite/

* gcc.target/i386/avx512vl-vnni-1.c: Rename..
* gcc.target/i386/avx512vl-vnni-1a.c: To This.
* gcc.target/i386/avx512vl-vnni-1b.c: New test.
* gcc.target/i386/avx512vl-vnni-2.c: Ditto.
* gcc.target/i386/avx512vl-vnni-3.c: Ditto.
* gcc.target/i386/avx-vnni-1.c: Ditto.
* gcc.target/i386/avx-vnni-2.c: Ditto.
* gcc.target/i386/avx-vnni-3.c: Ditto.
* gcc.target/i386/avx-vnni-4.c: Ditto.
* gcc.target/i386/avx-vnni-5.c: Ditto.
* gcc.target/i386/avx-vnni-6.c: Ditto.
* gcc.target/i386/avx-vpdpbusd-2.c: Ditto.
* gcc.target/i386/avx-vpdpbusds-2.c: Ditto.
* gcc.target/i386/avx-vpdpwssd-2.c: Ditto.
* gcc.target/i386/avx-vpdpwssds-2.c: Ditto.
* gcc.target/i386/vnni_inline_error.c: Ditto.
* gcc.target/i386/avx512vnnivl-builtin.c: Ditto.
* gcc.target/i386/avxvnni-builtin.c: Ditto.
* gcc.target/i386/funcspec-56.inc: Add new target attribute.
* gcc.target/i386/sse-12.c: Add -mavxvnni.
* gcc.target/i386/sse-13.c: Ditto.
* gcc.target/i386/sse-14.c: Ditto.
* gcc.target/i386/sse-22.c: Ditto.
* gcc.target/i386/sse-23.c: Ditto.
* g++.dg/other/i386-2.C: Ditto.
* g++.dg/other/i386-3.C: Ditto.
* lib/target-supports.exp (check_effective_target_avxvnni):
New proc.
48 files changed:
gcc/common/config/i386/cpuinfo.h
gcc/common/config/i386/i386-common.c
gcc/common/config/i386/i386-cpuinfo.h
gcc/common/config/i386/i386-isas.h
gcc/config.gcc
gcc/config/i386/avx512vnnivlintrin.h
gcc/config/i386/avxvnniintrin.h [new file with mode: 0644]
gcc/config/i386/cpuid.h
gcc/config/i386/i386-builtin.def
gcc/config/i386/i386-builtins.c
gcc/config/i386/i386-c.c
gcc/config/i386/i386-expand.c
gcc/config/i386/i386-options.c
gcc/config/i386/i386.h
gcc/config/i386/i386.md
gcc/config/i386/i386.opt
gcc/config/i386/immintrin.h
gcc/config/i386/sse.md
gcc/doc/extend.texi
gcc/doc/invoke.texi
gcc/doc/sourcebuild.texi
gcc/testsuite/g++.dg/other/i386-2.C
gcc/testsuite/g++.dg/other/i386-3.C
gcc/testsuite/gcc.target/i386/avx-vnni-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vnni-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vnni-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vnni-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vnni-5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vnni-6.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vpdpbusd-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vpdpbusds-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vpdpwssd-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx-vpdpwssds-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-vnni-1.c [deleted file]
gcc/testsuite/gcc.target/i386/avx512vl-vnni-1a.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-vnni-1b.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-vnni-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vl-vnni-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512vnnivl-builtin.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avxvnni-builtin.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/funcspec-56.inc
gcc/testsuite/gcc.target/i386/sse-12.c
gcc/testsuite/gcc.target/i386/sse-13.c
gcc/testsuite/gcc.target/i386/sse-14.c
gcc/testsuite/gcc.target/i386/sse-22.c
gcc/testsuite/gcc.target/i386/sse-23.c
gcc/testsuite/gcc.target/i386/vnni_inline_error.c [new file with mode: 0644]
gcc/testsuite/lib/target-supports.exp