public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Collison <michael.collison@linaro.org>
To: Jeff Law <law@redhat.com>,  Richard Biener <richard.guenther@gmail.com>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Optimize certain end of loop conditions into min/max operation
Date: Fri, 31 Jul 2015 18:48:00 -0000	[thread overview]
Message-ID: <55BBBBE6.2070207@linaro.org> (raw)
In-Reply-To: <55BBA052.2060900@redhat.com>

Hi Jeff,

Yes I will create a test case. I'm not quite sure what to check for even 
in the machine dependent test case. It's quite possible for the 
instructions that are generated to change over time.

On 7/31/2015 9:20 AM, Jeff Law wrote:
> On 07/28/2015 01:41 AM, Richard Biener wrote:
>>
>> The above case is a corner case I think - the number of && you can 
>> change
>> into (multiple) MIN/MAX is unbound but we might only care about the case
>> where there will be one MIN/MAX operation.
> I suspect that's going to be the most important/common case.
>
>>
>> Generally phiopt and other patterns that match the CFG are not yet well
>> supported by match.pd (though I outlined how matching PHI nodes when
>> facing (simplify (cond ...) ...) would be possible).
> Right.  Though I thought the conclusion after outlining we determined 
> it wasn't really feasible, yet.
>
>
>>
>> So while putting something into match.pd is easy I'd like people to
>> think if doing the same thing elsewhere is better - that is, if this 
>> is really
>> a pattern transform operation or if you are just implementing a 
>> special-case
>> of a general transform as a pattern.
> So in this case we're taking something like:
>
>  _6 = i_1 < m_4(D);
>   _7 = i_1 < n_3(D);
>   _8 = _6 & _7;
>   if (_8 != 0)
>
>
> And turning it into
>
> _X = MIN (m_4, n_3)
> if (i_1 < _X)
>
> That seems to me like a good match for match.pd given its generality 
> and the need to walk up the use-def chain.  It's certainly not a good 
> fit for phi-opt since we're not looking at PHIs :-)
>
>
>
> Michael -- can you take your sample code and turn it into a test for 
> the testsuite.  I'd hazard a guess it'll need to be target specific 
> because of its interactions with branch-costing.  Might as well make 4 
> variants (lt -> MIN, le -> MIN, ge->MAX, gt->MAX).
>
> We're going to want that regardless of whether tackling this issue in 
> match.pd (my current preference) or elsewhere.
>
> jeff

  reply	other threads:[~2015-07-31 18:18 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27  4:23 Michael Collison
2015-07-27  7:36 ` Bin.Cheng
2015-07-27  8:11   ` Bin.Cheng
2015-07-27  9:47 ` Richard Biener
2015-07-27 16:25   ` Jeff Law
2015-07-28  7:59     ` Richard Biener
2015-07-29 22:38       ` Michael Collison
2015-07-31 16:40       ` Jeff Law
2015-07-31 18:48         ` Michael Collison [this message]
2015-07-31 19:10           ` Jeff Law
2015-08-03  7:34             ` Richard Biener
2015-09-18  7:00             ` Michael Collison
2015-09-18  7:38               ` Marc Glisse
2015-09-18  7:41                 ` Marc Glisse
2015-09-18 10:06                   ` Richard Biener
2015-09-30  8:08                     ` Michael Collison
2015-09-30  9:10                       ` Richard Biener
2015-09-30 16:51                         ` Michael Collison
2015-09-30 21:12                           ` Marc Glisse
2015-10-01  5:40                             ` Michael Collison
2015-10-01  6:42                               ` Marc Glisse
2015-10-01  7:59                             ` Michael Collison
2015-10-01  8:05                               ` Marc Glisse
2015-10-01  8:21                                 ` Michael Collison
2015-10-06  9:21                                   ` Richard Biener
2015-09-18 22:01                 ` Michael Collison
2015-09-18 22:09                   ` Marc Glisse
2015-08-05 16:08   ` Alan Lawrence
2015-08-05 16:15     ` Jeff Law

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=55BBBBE6.2070207@linaro.org \
    --to=michael.collison@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=richard.guenther@gmail.com \
    /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).