Implement DecomposeRotate
authorMichelle McDaniel <adiaaida@gmail.com>
Wed, 19 Oct 2016 17:43:15 +0000 (10:43 -0700)
committerMichelle McDaniel <adiaaida@gmail.com>
Thu, 20 Oct 2016 19:40:32 +0000 (12:40 -0700)
commitd24a3008cd1bbed78dd4e82414228da6e21361d2
tree75a9b8c1f50ad9086646c2588eadd1d7313dc26c
parent2eefb2d2e64caec9e4c4bbbe805495109e35a1c3
Implement DecomposeRotate

fgRecognizeAndMorphBitwiseRotation can potentially morph a tree with a
TYP_LONG return type on x86 if the rotate amount is a GT_CNS_INT. This
change implements DecomposeRotate for those rotate instructions. There are
5 cases:

1) Rotate by 0: do nothing.
2) Rotate by 32: swap hi and lo.
3) Rotate by < 32: produce a shld/shld (for GT_ROL) or a shrd/shrd (for
GT_ROR).
4) Rotate by >= 32: swap hi and lo, subtract from the rotate amount 32, and
do option 3.
5) Rotate by >= 64: do rotateAmount % 64 to get the rotate amount between
0 and 63, then do one of options 1-4.

This change also updates CodegenBringUpTests\Rotate.cs to exercise these
paths.
src/jit/decomposelongs.cpp
src/jit/decomposelongs.h
tests/src/JIT/CodeGenBringUpTests/Rotate.cs