i386: Enable AVX512 memory broadcast for FNMSUB

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

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

gcc/

PR target/72782
- config/i386/avx512fintrin.h (_mm512_fnmsub_round_pd): Use __builtin_ia32_vfnmsubpd512_mask. (_mm512_mask_fnmsub_round_pd): Likewise. (_mm512_fnmsub_pd): Likewise. (_mm512_mask_fnmsub_pd): Likewise. (_mm512_maskz_fnmsub_round_pd): Use __builtin_ia32_vfnmsubpd512_maskz. (_mm512_maskz_fnmsub_pd): Likewise. (_mm512_fnmsub_round_ps): Use __builtin_ia32_vfnmsubps512_mask. (_mm512_mask_fnmsub_round_ps): Likewise. (_mm512_fnmsub_ps): Likewise. (_mm512_mask_fnmsub_ps): Likewise. (_mm512_maskz_fnmsub_round_ps): Use __builtin_ia32_vfnmsubps512_maskz. (_mm512_maskz_fnmsub_ps): Likewise.
- config/i386/avx512vlintrin.h (_mm256_mask_fnmsub_pd): Use __builtin_ia32_vfnmsubpd256_mask. (_mm256_maskz_fnmsub_pd): Use __builtin_ia32_vfnmsubpd256_maskz. (_mm_mask_fnmsub_pd): Use __builtin_ia32_vfmaddpd128_mask (_mm_maskz_fnmsub_pd): Use __builtin_ia32_vfnmsubpd128_maskz. (_mm256_mask_fnmsub_ps): Use __builtin_ia32_vfnmsubps256_mask. (_mm256_mask_fnmsub_ps): Use __builtin_ia32_vfnmsubps256_mask. (_mm256_maskz_fnmsub_ps): Use __builtin_ia32_vfnmsubps256_maskz. (_mm_mask_fnmsub_ps): Use __builtin_ia32_vfnmsubps128_mask. (_mm_maskz_fnmsub_ps): Use __builtin_ia32_vfnmsubps128_maskz.
- config/i386/fmaintrin.h (_mm_fnmsub_pd): Use __builtin_ia32_vfnmsubpd. (_mm256_fnmsub_pd): Use __builtin_ia32_vfnmsubpd256. (_mm_fnmsub_ps): Use __builtin_ia32_vfnmsubps. (_mm256_fnmsub_ps): Use __builtin_ia32_vfnmsubps256. (_mm_fnmsub_sd): Use __builtin_ia32_vfnmsubsd3. (_mm_fnmsub_ss): Use __builtin_ia32_vfnmsubss3.
- config/i386/i386-builtin.def: Add __builtin_ia32_vfnmsubpd256_mask, __builtin_ia32_vfnmsubpd256_maskz, __builtin_ia32_vfnmsubpd128_mask, __builtin_ia32_vfnmsubpd128_maskz, __builtin_ia32_vfnmsubps256_mask, __builtin_ia32_vfnmsubps256_maskz, __builtin_ia32_vfnmsubps128_mask, __builtin_ia32_vfnmsubps128_maskz, __builtin_ia32_vfnmsubpd512_mask, __builtin_ia32_vfnmsubpd512_maskz, __builtin_ia32_vfnmsubps512_mask, __builtin_ia32_vfnmsubps512_maskz, __builtin_ia32_vfnmsubss3, __builtin_ia32_vfnmsubsd3, __builtin_ia32_vfnmsubps, __builtin_ia32_vfnmsubpd, __builtin_ia32_vfnmsubps256 and. __builtin_ia32_vfnmsubpd256.
- config/i386/sse.md (fma4i_fnmsub_): New. (_fnmsub__maskz): Likewise. (*fma_fnmsub__bcst_1): Likewise. (*fma_fnmsub__bcst_2): Likewise. (*fma_fnmsub__bcst_3): Likewise. (fmai_vmfnmsub_): Likewise.

gcc/testsuite/

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

44f0b97dcd5 i386: Enable AVX512 memory broadcast for FNMSUB
gcc/ChangeLog | 61 ++++++++++++++++
gcc/config/i386/avx512fintrin.h | 80 ++++++++++-----------
gcc/config/i386/avx512vlintrin.h | 32 ++++-----
gcc/config/i386/fmaintrin.h | 24 +++----
gcc/config/i386/i386-builtin.def | 12 ++++
gcc/config/i386/sse.md | 82 ++++++++++++++++++++++
gcc/testsuite/ChangeLog | 15 ++++
.../gcc.target/i386/avx512f-fnmsub-df-zmm-1.c | 12 ++++
.../gcc.target/i386/avx512f-fnmsub-sf-zmm-1.c | 12 ++++
.../gcc.target/i386/avx512f-fnmsub-sf-zmm-2.c | 12 ++++
.../gcc.target/i386/avx512f-fnmsub-sf-zmm-3.c | 12 ++++
.../gcc.target/i386/avx512f-fnmsub-sf-zmm-4.c | 12 ++++
.../gcc.target/i386/avx512f-fnmsub-sf-zmm-5.c | 12 ++++
.../gcc.target/i386/avx512f-fnmsub-sf-zmm-6.c | 12 ++++
.../gcc.target/i386/avx512f-fnmsub-sf-zmm-7.c | 12 ++++
.../gcc.target/i386/avx512f-fnmsub-sf-zmm-8.c | 12 ++++
.../gcc.target/i386/avx512vl-fnmsub-sf-xmm-1.c | 12 ++++
.../gcc.target/i386/avx512vl-fnmsub-sf-ymm-1.c | 12 ++++
18 files changed, 370 insertions(+), 68 deletions(-)

Upstream: gcc.gnu.org


  • Share