This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: shift/extract SHIFT_COUNT_TRUNCATED combine bug


On Tue, Jan 13, 2015 at 6:38 PM, Segher Boessenkool
<segher@kernel.crashing.org> wrote:
> On Tue, Jan 13, 2015 at 10:51:27AM +0100, Richard Biener wrote:
>> IMHO SHIFT_COUNT_TRUNCATED should be removed and instead
>> backends should provide shift patterns with a (and:QI ...) for the
>> shift amount which simply will omit that operation if suitable.
>
> Note that that catches less though, e.g. in
>
> int f(int x, int n) { return x << ((2*n) & 31); }
>
> without SHIFT_COUNT_TRUNCATED it will try to match an AND with 30,
> not with 31.

But even with SHIFT_COUNT_TRUNCATED you cannot omit the
and as it clears the LSB.  Only at a higher level we might be tempted
to drop the & 31 while it still persists in its original form (not sure
if fold does that - I don't see SHIFT_COUNT_TRUNCATED mentioned there).

Richard.

>
> Segher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]