public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Prathamesh Kulkarni <bilbotheelffriend@gmail.com>
To: marc.glisse@inria.fr, gcc <gcc@gcc.gnu.org>
Cc: Richard Biener <richard.guenther@gmail.com>
Subject: Re: [gsoc 2014] moving fold-const patterns to gimple
Date: Fri, 14 Mar 2014 16:37:00 -0000	[thread overview]
Message-ID: <CAJXstsABNmQueX9tA0Ty=rH+8m=nEANLPBN7Umme-5W59fsBRA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1403141647330.3584@laptop-mg.saclay.inria.fr>

On Fri, Mar 14, 2014 at 9:25 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
> On Fri, 14 Mar 2014, Prathamesh Kulkarni wrote:
>
>> I had a look at PR 14753
>> (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14753) from the first
>> link. I have tried to implement those transforms (attached patch,
>> stage-1 compiled).
>> I have written the transforms to operate on GENERIC.
>
>
> Why not directly gimple or the .pd file?
>
>
>> Is that correct ?
>> The patterns mentioned in the links were:
>> a) (X >> CST1) >= CST2 -> X >= CST2 << CST1
>> however, an expression Y >= CST gets folded to Y > CST - 1
>> so the transform I wrote:
>> (X >> CST1) > CST2 -> X > CST2 << CST1
>
>
> That's not the same, try X=1, CST1=1, CST2=0.
Ah yes. Shall following be correct ?
(X >> CST1) > CST2 -> X > ( (CST2 + 1) << CST1 ) - 1
Works correctly for X=1, CST1 = 1, CST2 = 0

(X >> CST1) > CST2
=> (X >> CST1) >= (CST2 + 1)   // this pattern is mentioned in PR
=> X >= (CST2 + 1) << CST1
=> X > ((CST2 + 1) << CST1) - 1
>
>
>> b) (X & ~CST) == 0 -> X <= CST
>
>
> Uh, that can't be true for all constants, only some with a very specific
> shape (7 is 2^3-1).
Agreed. Shall the pattern be folded if CST is 2^(n-1) ?
>
> --
> Marc Glisse

  reply	other threads:[~2014-03-14 16:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 20:13 Prathamesh Kulkarni
2014-03-03 10:02 ` Richard Biener
2014-03-06 12:11   ` Prathamesh Kulkarni
2014-03-06 12:43     ` Richard Biener
2014-03-06 18:17       ` Prathamesh Kulkarni
2014-03-07  9:08         ` Richard Biener
2014-03-10 18:29           ` Prathamesh Kulkarni
2014-03-11 11:20             ` Richard Biener
2014-03-13 11:14               ` Richard Biener
2014-03-14 15:31                 ` Prathamesh Kulkarni
2014-03-14 15:35                   ` Prathamesh Kulkarni
2014-03-14 15:55                   ` Marc Glisse
2014-03-14 16:37                     ` Prathamesh Kulkarni [this message]
2014-03-14 17:54                       ` Marc Glisse
2014-03-14 17:16                   ` Richard Biener
2014-03-16 12:21                     ` Prathamesh Kulkarni
2014-03-17  8:52                       ` Richard Biener
2014-03-18  8:13                         ` Prathamesh Kulkarni
2014-03-19  0:27                           ` Maxim Kuvyrkov
     [not found]                         ` <CAJXstsD0Y=vBxw9QveOU3O3jhQgbYkxj_iyfje=AFypHEmK9gA@mail.gmail.com>
2014-03-19  9:43                           ` Richard Biener
2014-03-20 20:52                             ` Prathamesh Kulkarni
2014-03-21  9:49                               ` Richard Biener

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='CAJXstsABNmQueX9tA0Ty=rH+8m=nEANLPBN7Umme-5W59fsBRA@mail.gmail.com' \
    --to=bilbotheelffriend@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=marc.glisse@inria.fr \
    --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).