public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: James Greenhalgh <james.greenhalgh@arm.com>
To: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>, nd <nd@arm.com>,
	"sje@gcc.gnu.org"	<sje@gcc.gnu.org>
Subject: Re: [PATCH][AArch64] PR84114: Avoid reassociating FMA
Date: Mon, 26 Feb 2018 22:25:00 -0000	[thread overview]
Message-ID: <20180226222545.GA3086@arm.com> (raw)
In-Reply-To: <DB6PR0801MB20536FBEAD77DF5C8B8490FF83CD0@DB6PR0801MB2053.eurprd08.prod.outlook.com>

On Thu, Feb 22, 2018 at 11:38:03AM +0000, Wilco Dijkstra wrote:
> 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.
> 
> OK for commit?

This is OK as a fairly safe fix for stage 4. We should fix reassociation
properly in GCC 9.

Thanks,
James

> 
> ChangeLog:
> 2018-02-23  Wilco Dijkstra  <wdijkstr@arm.com>
> 
> 	PR tree-optimization/84114
> 	* config/aarch64/aarch64.c (aarch64_reassociation_width)
> 	Avoid reassociation of FLOAT_MODE addition.
> --
> 
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index b3d5fde171920e5759046a4bd61cfcf9eb78d7dd..5f9541cf700aaf18c1f1ac73054614e2932781e4 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -1109,15 +1109,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;
>  }

  reply	other threads:[~2018-02-26 22:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-22 11:38 Wilco Dijkstra
2018-02-26 22:25 ` James Greenhalgh [this message]
2018-02-27 13:19   ` Richard Biener
2018-02-27 14:21     ` Wilco Dijkstra
2018-02-27 18:31       ` Aaron Sawdey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180226222545.GA3086@arm.com \
    --to=james.greenhalgh@arm.com \
    --cc=Wilco.Dijkstra@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nd@arm.com \
    --cc=sje@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).