https://gcc.gnu.org/bugzilla/show_bug.cgi?id=31178

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Andrew Macleod from comment #9)
> Seems like it may expose a problem in gcc.target/i386/sse2-v1ti-shift-3.c as
> well:
> 
>  for (i=0; i<128; i++) {
> <...>
>     if ((ti)rotr_v1ti(ut,i) != (ti)rotr_ti(x,i))
>       __builtin_abort();
>     if ((ti)rotl_v1ti(ut,i) != (ti)rotl_ti(x,i))
> 
> And those are defined:
> 
> uv1ti rotr_v1ti(uv1ti x, unsigned int i) { return (x >> i) | (x << (128-i));
> }
> uv1ti rotl_v1ti(uv1ti x, unsigned int i) { return (x << i) | (x >> (128-i));
> }
> 
> so when i is 0, they can perform a shift of 128 on a 128 bit object.

That just means they should be fixed.
As documented above simplify_rotate in tree-ssa-forwprop.cc, we pattern match a
lot of forms and many of those are safe for any rotate count.
If only 0..127 is supposed to be valid for i, then e.g.
   (x << i) | (x >> ((-i) & 127))
will do.

Reply via email to