On Fri, 13 May 2016, Mikhail Maltsev wrote:
I don't know if we might want some :c / single_use restrictions, maybe on the
outer convert and the rshift/rotate.
I don't think :c can be used here.
Oups, typo for :s.
As for :s, I added it, as you suggested.
:s will be ignored when there is no conversion, but I think that's good
enough for now.
Also, I tried to add some more test cases for rotate with conversions, but
unfortunately GCC does not recognize rotate pattern, when narrowing conversions
are present.
It is usually easier to split your expression into several assignments.
Untested:
int f(long long a, unsigned long n){
long long b = ~a;
unsigned long c = b;
unsigned long d = ROLL (c, n);
int e = d;
return ~e;
}
this way the rotate pattern is detected early (generic) with no extra
operations to confuse the compiler, while your new transformation will
happen in gimple (most likely the first forwprop pass).
The patch looks good to me, now wait for Richard's comments.
--
Marc Glisse