aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2018-03-05 14:40:55 +0000
committerWilco Dijkstra <wilco@gcc.gnu.org>2018-03-05 14:40:55 +0000
commitb5b33e113434be909e8a6d7b93824196fb6925c0 (patch)
treefa0e943425147bcc2a1bec6d4cafc2027dba79e1
parent13b93d4b899bd7390429113d2ac98ec057a8c3d2 (diff)
downloadgcc-b5b33e113434be909e8a6d7b93824196fb6925c0.zip
gcc-b5b33e113434be909e8a6d7b93824196fb6925c0.tar.gz
gcc-b5b33e113434be909e8a6d7b93824196fb6925c0.tar.bz2
[AArch64] PR84114: Avoid reassociating FMA
As discussed in the PR, the reassociation phase runs before FMAs are formed and so can significantly reduce FMA opportunities. Although reassociation could be switched off, it helps in many cases, so a better alternative is to only avoid reassociation of floating point additions. This fixes the testcase and gives 1% speedup on SPECFP2017, fixing the performance regression. gcc/ PR tree-optimization/84114 * config/aarch64/aarch64.c (aarch64_reassociation_width) Avoid reassociation of FLOAT_MODE addition. From-SVN: r258248
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/aarch64/aarch64.c7
2 files changed, 10 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 28e31de..eeb3633 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-05 Wilco Dijkstra <wdijkstr@arm.com>
+
+ PR tree-optimization/84114
+ * config/aarch64/aarch64.c (aarch64_reassociation_width)
+ Avoid reassociation of FLOAT_MODE addition.
+
2018-03-05 Olga Makhotina <olga.makhotina@intel.com>
* common/config/i386/i386-common.c (OPTION_MASK_ISA_PCONFIG_SET,
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 2f98a21..07c55b1 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1094,15 +1094,16 @@ aarch64_min_divisions_for_recip_mul (machine_mode mode)
return aarch64_tune_params.min_div_recip_mul_df;
}
+/* Return the reassociation width of treeop OPC with mode MODE. */
static int
-aarch64_reassociation_width (unsigned opc ATTRIBUTE_UNUSED,
- machine_mode mode)
+aarch64_reassociation_width (unsigned opc, machine_mode mode)
{
if (VECTOR_MODE_P (mode))
return aarch64_tune_params.vec_reassoc_width;
if (INTEGRAL_MODE_P (mode))
return aarch64_tune_params.int_reassoc_width;
- if (FLOAT_MODE_P (mode))
+ /* Avoid reassociating floating point addition so we emit more FMAs. */
+ if (FLOAT_MODE_P (mode) && opc != PLUS_EXPR)
return aarch64_tune_params.fp_reassoc_width;
return 1;
}