public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-patches@sourceware.org
Subject: Re: [RS6000] rs6000_rtx_costs cost IOR
Date: Thu, 17 Sep 2020 13:12:19 +0930	[thread overview]
Message-ID: <20200917034219.GP5452@bubble.grove.modra.org> (raw)
In-Reply-To: <20200917000206.GI28786@gate.crashing.org>

On Wed, Sep 16, 2020 at 07:02:06PM -0500, Segher Boessenkool wrote:
> Hi!
> 
> On Tue, Sep 15, 2020 at 10:49:44AM +0930, Alan Modra wrote:
> > 	* config/rs6000/rs6000.c (rs6000_rtx_costs): Cost IOR.
> 
> >      case IOR:
> > -      /* FIXME */
> >        *total = COSTS_N_INSNS (1);
> > -      return true;
> 
> Hey this was okay for over five years :-)
> 
> > +      left = XEXP (x, 0);
> > +      if (GET_CODE (left) == AND
> > +	  && CONST_INT_P (XEXP (left, 1)))
> 
> Add a comment that this is the integer insert insns?
> 
> > +	      // rotlsi3_insert_5
> 
> But use /* comments */.
> 
> > +		  /* Test both regs even though the one in the mask is
> > +		     constrained to be equal to the output.  Increasing
> > +		     cost may well result in rejecting an invalid insn
> > +		     earlier.  */
> 
> Is that ever actually useful?

Possibly not in this particular case, but I did see cases where
invalid insns were rejected early by costing non-reg sub-expressions.

Beside that, the default position on rtx_costs paths that return true
should be to cost any sub-expressions unless you know for sure they
are zero cost.  And yes, we fail to do that for some cases,
eg. mul_highpart.

> So this new block is pretty huge.  Can it easily be factored to a
> separate function?  Just the insert insns part, not all IOR.

Done in my local tree.

> Okay for trunk with the comments changed to the correct syntax, and
> factoring masked insert out to a separate function pre-approved if you
> want to do that.  Thanks!

I'll hold off committing until the whole rtx_costs patch series is
reviewed (not counting the rotate_and_mask_constant patch).

-- 
Alan Modra
Australia Development Lab, IBM

  reply	other threads:[~2020-09-17  3:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15  1:19 [RS6000] rtx_costs 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 [this message]
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 ` [RS6000] rtx_costs will schmidt

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=20200917034219.GP5452@bubble.grove.modra.org \
    --to=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).