i386: Avoid fma_chain for -march=alderlake and sapphirerapids.

For Alderlake there is similar issue like PR 81616, enable
avoid_fma256_chain will also benefit on Intel latest platforms
Alderlake and Sapphire Rapids.

gcc/ChangeLog:

	* config/i386/x86-tune.def (X86_TUNE_AVOID_256FMA_CHAINS): Add
	m_SAPPHIRERAPIDS, m_ALDERLAKE.
This commit is contained in:
Hongyu Wang 2022-12-14 10:58:31 +08:00 committed by Hu, Lin1
parent eb34b0fb56
commit 57239231b9
2 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From b7980cd8d8bcf41b3ca1b6f3ba147789d42a9b99 Mon Sep 17 00:00:00 2001
From: Hongyu Wang <hongyu.wang@intel.com>
Date: Tue, 6 Dec 2022 09:53:35 +0800
Subject: [PATCH] i386: Avoid fma_chain for -march=alderlake and
sapphirerapids.
For Alderlake there is similar issue like PR 81616, enable
avoid_fma256_chain will also benefit on Intel latest platforms
Alderlake and Sapphire Rapids.
gcc/ChangeLog:
* config/i386/x86-tune.def (X86_TUNE_AVOID_256FMA_CHAINS): Add
m_SAPPHIRERAPIDS, m_ALDERLAKE.
---
gcc/config/i386/x86-tune.def | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/config/i386/x86-tune.def b/gcc/config/i386/x86-tune.def
index d983e2f6213..1e1b206a71c 100644
--- a/gcc/config/i386/x86-tune.def
+++ b/gcc/config/i386/x86-tune.def
@@ -485,7 +485,8 @@ DEF_TUNE (X86_TUNE_AVOID_128FMA_CHAINS, "avoid_fma_chains", m_ZNVER)
/* X86_TUNE_AVOID_256FMA_CHAINS: Avoid creating loops with tight 256bit or
smaller FMA chain. */
-DEF_TUNE (X86_TUNE_AVOID_256FMA_CHAINS, "avoid_fma256_chains", m_ZNVER2 | m_ZNVER3)
+DEF_TUNE (X86_TUNE_AVOID_256FMA_CHAINS, "avoid_fma256_chains", m_ZNVER2 | m_ZNVER3
+ | m_ALDERLAKE | m_SAPPHIRERAPIDS)
/* X86_TUNE_V2DF_REDUCTION_PREFER_PHADDPD: Prefer haddpd
for v2df vector reduction. */
--
2.18.2

View File

@ -86,7 +86,7 @@
Summary: Various compilers (C, C++, Objective-C, ...)
Name: %{?scl_prefix}gcc%{gcc_ver}
Version: 12.2.1
Release: 13
Release: 14
# libgcc, libgfortran, libgomp, libstdc++ and crtstuff have
# GCC Runtime Exception.
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ with exceptions and LGPLv2+ and BSD
@ -140,6 +140,7 @@ Patch2: 0003-Remove-AVX512_VP2INTERSECT-from-PTA_SAPPHIRERAPIDS.patch
Patch3: 0004-Add-attribute-hot-judgement-for-INLINE_HINT_known_ho.patch
Patch4: 0005-Enable-small-loop-unrolling-for-O2.patch
Patch5: 0006-i386-Only-enable-small-loop-unrolling-in-backend-PR-.patch
Patch6: 0007-i386-Avoid-fma_chain-for-march-alderlake-and-sapphir.patch
# On ARM EABI systems, we do want -gnueabi to be part of the
@ -603,6 +604,7 @@ not stable, so plugins must be rebuilt any time GCC is updated.
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
echo '%{vendor} %{version}-%{release}' > gcc/DEV-PHASE
@ -2663,6 +2665,9 @@ end
%doc rpm.doc/changelogs/libcc1/ChangeLog*
%changelog
* Wed Dec 14 2022 Hongyu Wang <hongyu.wang@intel.com> 12.2.1-14
- i386: Avoid fma_chain for -march=alderlake and sapphirerapids
* Tue Nov 29 2022 Hongyu Wang <hongyu.wang@intel.com> 12.2.1-13
- i386: Only enable small loop unrolling in backend [PR 107692]