This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [gsoc 2014] moving fold-const patterns to gimple
- From: Prathamesh Kulkarni <bilbotheelffriend at gmail dot com>
- To: marc dot glisse at inria dot fr, gcc <gcc at gcc dot gnu dot org>
- Cc: Richard Biener <richard dot guenther at gmail dot com>
- Date: Fri, 14 Mar 2014 22:07:28 +0530
- Subject: Re: [gsoc 2014] moving fold-const patterns to gimple
- Authentication-results: sourceware.org; auth=none
- References: <CAJXstsDSbO7QTSkJ-y4ftO4SshGkwYuow+U0nb4FdHSjHtfB=A at mail dot gmail dot com> <CAFiYyc0UqPLoV76gUWiUXzCa3SxumXrmq7vsFtJ4GtnNjVrf3A at mail dot gmail dot com> <CAJXstsAAA0=2ELCaai8SdM3e3S1S2hcigUF2A=s0jS-ytwCXdA at mail dot gmail dot com> <CAFiYyc09sUOGGaPzRge6ysr1TzucGCMufFSQbTy5GADXWh5rTg at mail dot gmail dot com> <CAJXstsAuf8PSvbFMudDV43xdJTQ5wxYoiRGO5MJ-u0QCZYVunw at mail dot gmail dot com> <CAFiYyc0k=onaLtokpzsbbHDQ7SvotYdpkuF5z+UyVwC2JhkFnA at mail dot gmail dot com> <CAJXstsCD1EEMKqB19-=7SOrsmQgNFn23+mUe0+S-bPULHLgbXg at mail dot gmail dot com> <CAFiYyc2W7nmYnpBFF-xhO3G4rGzVLXvZoCaRV6UTo_2aZNxuxA at mail dot gmail dot com> <CAFiYyc2WRuH7Am42zBQd2-h6tatsgX8Wn9ECb_b_QNq0FYTA1g at mail dot gmail dot com> <CAJXstsC86wTB6oWdaCqtcR6vP4k4OJu0eAsoTLxsp_iXz48hvg at mail dot gmail dot com> <alpine dot DEB dot 2 dot 10 dot 1403141647330 dot 3584 at laptop-mg dot saclay dot inria dot 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