LegalizeIntegerTypes: Reenable the large shift with small amount optimization.
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 28 Feb 2012 17:58:00 +0000 (17:58 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 28 Feb 2012 17:58:00 +0000 (17:58 +0000)
commit3bf15ced2b91661ac314911c1f28332da0e1c37c
tree73b480a3b1612372c3c122f9b17834e1141f18e2
parent20bd5296cec8d8d597ab9db2aca7346a88e580c8
LegalizeIntegerTypes: Reenable the large shift with small amount optimization.

To avoid problems with zero shifts when getting the bits that move between words
we use a trick: first shift the by amount-1, then do another shift by one. When
amount is 0 (and size 32) we first shift by 31, then by one, instead of by 32.

Also fix a latent bug that emitted the low and high words in the wrong order
when shifting right.

Fixes PR12113.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151637 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
test/CodeGen/X86/2008-12-16-BadShift.ll [deleted file]
test/CodeGen/X86/legalize-shift-64.ll [new file with mode: 0644]