Optimizing: Simplify UShr+And, Shr+And.

Eliminate And from UShr+And if the And-mask contains all the
bits that can be non-zero after UShr. Transform Shr+And to
UShr if the And-mask precisely clears the shifted-in sign
bits.

This prepares for detecting the Rotate pattern, i.e.
  (x << N) | (x >>> (SIZE - N))
in code that unnecessarily masks the UShr, for example
  (x << 1) | ((x >>> 31) & 1) ,
or uses Shr, for example
  (x << 8) | ((x >> 24) & 0xff) .

Change-Id: I684c4b752547d9b1057d0d4c4d44550bb1a3ffb4
2 files changed