public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: will schmidt <will_schmidt@vnet.ibm.com>
To: Alan Modra <amodra@gmail.com>,
	Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-patches@sourceware.org
Subject: Re: [RS6000] rtx_costs
Date: Tue, 15 Sep 2020 13:15:29 -0500	[thread overview]
Message-ID: <0f9db93107de8948f6a3bc88d8ab98921513ce66.camel@vnet.ibm.com> (raw)
In-Reply-To: <20200915011946.3395-1-amodra@gmail.com>

On Tue, 2020-09-15 at 10:49 +0930, Alan Modra via Gcc-patches wrote:
> This patch series fixes a number of issues in rs6000_rtx_costs, the
> aim being to provide costing somewhat closer to reality.  Probably
> the
> most important patch of the series is patch 4, which just adds a
> comment.  Without the analysis that went into that comment, I found
> myself making what seemed to be good changes but which introduced
> regressions.
> 
> So far these changes have not introduced any testsuite regressions
> on --with-cpu=power8 and --with-cpu=power9 all lang bootstraps on
> powerpc64le-linux.  Pat spec tested on power9 against a baseline
> master from a few months ago, seeing a few small improvements and no
> degradations above the noise.

I've read through all the patches in this series, (including the tests
that were sent a bit later).  Your use of comments does a good job
helping describe whats going on.

One comment/question/point of clarity for the AND patch that I'll send
separately.  

That said, the series lgtm.  :-) 

thanks, 
-Will


> 
> Some notes:
> 
> Examination of varasm.o shows quite a number of cases where
> if-conversion succeeds due to different seq_cost.  One example:
> 
> extern int foo ();
> int
> default_assemble_integer (unsigned size)
> {
>   extern unsigned long rs6000_isa_flags;
> 
>   if (size > (!((rs6000_isa_flags & (1UL << 35)) != 0) ? 4 : 8))
>     return 0;
>   return foo ();
> }
> 
> This rather horrible code turns the rs6000_isa_flags value into
> either
> 4 or 8:
> 	rldicr 9,9,28,0
> 	srdi 9,9,28
> 	addic 9,9,-1
> 	subfe 9,9,9
> 	rldicr 9,9,0,61
> 	addi 9,9,8
> Better would be
> 	rldicl 9,9,29,63
> 	sldi 9,9,2
> 	addi 9,9,4
> 
> There is also a "rlwinm ra,rb,3,0,26" instead of "rldicr ra,rb,3,60",
> and "li r31,0x4000; rotldi r31,r31,17" vs.
> "lis r31,0x8000; clrldi r31,r31,32".
> Neither of these is a real change.  I saw one occurrence of a 5 insn
> sequence being replaced with a load from memory in
> default_function_rodata_section, for ".rodata", and others elsewhere.
> 
> Sometimes correct insn cost leads to unexpected results.  For
> example:
> 
> extern unsigned bar (void);
> unsigned
> f1 (unsigned a)
> {
>   if ((a & 0x01000200) == 0x01000200)
>     return bar ();
>   return 0;
> }
> 
> emits for a & 0x01000200
>  (set (reg) (and (reg) (const_int 0x01000200)))
> at expand time (two rlwinm insns) rather than the older
>  (set (reg) (const_int 0x01000200))
>  (set (reg) (and (reg) (reg)))
> which is three insns.  However, since 0x01000200 is needed later the
> older code after optimisation is smaller.


      parent reply	other threads:[~2020-09-15 18:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15  1:19 Alan Modra
2020-09-15  1:19 ` [RS6000] Count rldimi constant insns Alan Modra
2020-09-15 22:29   ` Segher Boessenkool
2020-09-15  1:19 ` [RS6000] rs6000_rtx_costs for PLUS/MINUS constant Alan Modra
2020-09-15 22:31   ` Segher Boessenkool
2020-09-15  1:19 ` [RS6000] rs6000_rtx_costs for AND Alan Modra
2020-09-15 18:15   ` will schmidt
2020-09-16  7:24     ` Alan Modra
2020-09-15  1:19 ` [RS6000] rs6000_rtx_costs comment Alan Modra
2020-09-16 23:21   ` Segher Boessenkool
2020-09-15  1:19 ` [RS6000] rs6000_rtx_costs multi-insn constants Alan Modra
2020-09-16 23:28   ` Segher Boessenkool
2020-09-15  1:19 ` [RS6000] rs6000_rtx_costs cost IOR Alan Modra
2020-09-17  0:02   ` Segher Boessenkool
2020-09-17  3:42     ` Alan Modra
2020-09-21 15:49       ` Segher Boessenkool
2020-09-21 23:54         ` Alan Modra
2020-09-15  1:19 ` [RS6000] rs6000_rtx_costs reduce cost for SETs Alan Modra
2020-09-17 17:51   ` Segher Boessenkool
2020-09-18  3:38     ` Alan Modra
2020-09-18 18:13       ` Segher Boessenkool
2020-09-21  7:07         ` Alan Modra
2020-09-15  1:19 ` [RS6000] rotate and mask constants Alan Modra
2020-09-15  7:16   ` Alan Modra
2020-09-21 15:56     ` Segher Boessenkool
2020-09-15 18:15 ` will schmidt [this message]

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=0f9db93107de8948f6a3bc88d8ab98921513ce66.camel@vnet.ibm.com \
    --to=will_schmidt@vnet.ibm.com \
    --cc=amodra@gmail.com \
    --cc=gcc-patches@sourceware.org \
    --cc=segher@kernel.crashing.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).