i386: Enable AVX512 memory broadcast for FNMADD

Programming / Compilers / GCC - hjl [138bc75d-0d04-0410-961f-82ee72b054a4] - 21 October 2018 20:27 EDT

Many AVX512 vector operations can broadcast from a scalar memory source. This patch enables memory broadcast for FNMADD operations. In order to support AVX512 memory broadcast for FNMADD, FNMADD builtin functions are also added, instead of passing the negated value to FMA builtin functions.

gcc/

PR target/72782
- config/i386/avx512fintrin.h (_mm512_fnmadd_round_pd): Use __builtin_ia32_vfnmaddpd512_mask. (_mm512_mask_fnmadd_round_pd): Likewise. (_mm512_fnmadd_pd): Likewise. (_mm512_mask_fnmadd_pd): Likewise. (_mm512_maskz_fnmadd_round_pd): Use __builtin_ia32_vfnmaddpd512_maskz. (_mm512_maskz_fnmadd_pd): Likewise. (_mm512_fnmadd_round_ps): Use __builtin_ia32_vfnmaddps512_mask. (_mm512_mask_fnmadd_round_ps): Likewise. (_mm512_fnmadd_ps): Likewise. (_mm512_mask_fnmadd_ps): Likewise. (_mm512_maskz_fnmadd_round_ps): Use __builtin_ia32_vfnmaddps512_maskz. (_mm512_maskz_fnmadd_ps): Likewise.
- config/i386/avx512vlintrin.h (_mm256_mask_fnmadd_pd): Use __builtin_ia32_vfnmaddpd256_mask. (_mm256_maskz_fnmadd_pd): Use __builtin_ia32_vfnmaddpd256_maskz. (_mm_mask_fnmadd_pd): Use __builtin_ia32_vfmaddpd128_mask (_mm_maskz_fnmadd_pd): Use __builtin_ia32_vfnmaddpd128_maskz. (_mm256_mask_fnmadd_ps): Use __builtin_ia32_vfnmaddps256_mask. (_mm256_mask_fnmadd_ps): Use __builtin_ia32_vfnmaddps256_mask. (_mm256_maskz_fnmadd_ps): Use __builtin_ia32_vfnmaddps256_maskz. (_mm_mask_fnmadd_ps): Use __builtin_ia32_vfnmaddps128_mask. (_mm_maskz_fnmadd_ps): Use __builtin_ia32_vfnmaddps128_maskz.
- config/i386/fmaintrin.h (_mm_fnmadd_pd): Use __builtin_ia32_vfnmaddpd. (_mm256_fnmadd_pd): Use __builtin_ia32_vfnmaddpd256. (_mm_fnmadd_ps): Use __builtin_ia32_vfnmaddps. (_mm256_fnmadd_ps): Use __builtin_ia32_vfnmaddps256. (_mm_fnmadd_sd): Use __builtin_ia32_vfnmaddsd3. (_mm_fnmadd_ss): Use __builtin_ia32_vfnmaddss3.
- config/i386/i386-builtin.def: Add __builtin_ia32_vfnmaddpd256_mask, __builtin_ia32_vfnmaddpd256_maskz, __builtin_ia32_vfnmaddpd128_mask, __builtin_ia32_vfnmaddpd128_maskz, __builtin_ia32_vfnmaddps256_mask, __builtin_ia32_vfnmaddps256_maskz, __builtin_ia32_vfnmaddps128_mask, __builtin_ia32_vfnmaddps128_maskz, __builtin_ia32_vfnmaddpd512_mask, __builtin_ia32_vfnmaddpd512_maskz, __builtin_ia32_vfnmaddps512_mask, __builtin_ia32_vfnmaddps512_maskz, __builtin_ia32_vfnmaddss3, __builtin_ia32_vfnmaddsd3, __builtin_ia32_vfnmaddps, __builtin_ia32_vfnmaddpd, __builtin_ia32_vfnmaddps256 and. __builtin_ia32_vfnmaddpd256.
- config/i386/sse.md (fma4i_fnmadd_): New. (_fnmadd__maskz): Likewise. (*fma_fnmadd__bcst_1): Likewise. (*fma_fnmadd__bcst_2): Likewise. (*fma_fnmadd__bcst_3): Likewise. (fmai_vmfnmadd_): Likewise.

gcc/testsuite/

PR target/72782
- gcc.target/i386/avx512f-fnmadd-df-zmm-1.c: New test.
- gcc.target/i386/avx512f-fnmadd-sf-zmm-1.c: Likewise.
- gcc.target/i386/avx512f-fnmadd-sf-zmm-2.c: Likewise.
- gcc.target/i386/avx512f-fnmadd-sf-zmm-3.c: Likewise.
- gcc.target/i386/avx512f-fnmadd-sf-zmm-4.c: Likewise.
- gcc.target/i386/avx512f-fnmadd-sf-zmm-5.c: Likewise.
- gcc.target/i386/avx512f-fnmadd-sf-zmm-6.c: Likewise.
- gcc.target/i386/avx512f-fnmadd-sf-zmm-7.c: Likewise.
- gcc.target/i386/avx512f-fnmadd-sf-zmm-8.c: Likewise.
- gcc.target/i386/avx512vl-fnmadd-sf-xmm-1.c: Likewise.
- gcc.target/i386/avx512vl-fnmadd-sf-ymm-1.c: Likewise.

0bdb7b963de i386: Enable AVX512 memory broadcast for FNMADD
gcc/ChangeLog | 61 ++++++++++
gcc/config/i386/avx512fintrin.h | 124 ++++++++++-----------
gcc/config/i386/avx512vlintrin.h | 64 +++++------
gcc/config/i386/fmaintrin.h | 24 ++--
gcc/config/i386/i386-builtin.def | 20 ++++
gcc/config/i386/sse.md | 77 +++++++++++++
gcc/testsuite/ChangeLog | 15 +++
.../gcc.target/i386/avx512f-fnmadd-df-zmm-1.c | 12 ++
.../gcc.target/i386/avx512f-fnmadd-sf-zmm-1.c | 12 ++
.../gcc.target/i386/avx512f-fnmadd-sf-zmm-2.c | 12 ++
.../gcc.target/i386/avx512f-fnmadd-sf-zmm-3.c | 12 ++
.../gcc.target/i386/avx512f-fnmadd-sf-zmm-4.c | 12 ++
.../gcc.target/i386/avx512f-fnmadd-sf-zmm-5.c | 12 ++
.../gcc.target/i386/avx512f-fnmadd-sf-zmm-6.c | 12 ++
.../gcc.target/i386/avx512f-fnmadd-sf-zmm-7.c | 12 ++
.../gcc.target/i386/avx512f-fnmadd-sf-zmm-8.c | 12 ++
.../gcc.target/i386/avx512vl-fnmadd-sf-xmm-1.c | 12 ++
.../gcc.target/i386/avx512vl-fnmadd-sf-ymm-1.c | 12 ++
18 files changed, 411 insertions(+), 106 deletions(-)

Upstream: gcc.gnu.org


  • Share