[X86] Use MOVSX by default instead of CBW to extend i8 to AX for i8 sdivrem.
authorCraig Topper <craig.topper@intel.com>
Fri, 6 Sep 2019 19:17:02 +0000 (19:17 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 6 Sep 2019 19:17:02 +0000 (19:17 +0000)
commit50eeea1f07d2f63300bc728fbc31879edf7c2f46
treeeee9b3cba919f8810df49ea6d04ebdde8d8eba76
parent1935dd03cb145f3f86a5e076692a3974543eb6b5
[X86] Use MOVSX by default instead of CBW to extend i8 to AX for i8 sdivrem.

We can use a MOVSX16 here then rely on FixupBWInst to change to
MOVSX32 if the upper bits are dead. With a special case to
not promote if it could be turned into CBW.

Then we can rely on X86MCInstLower to turn the MOVSX into CBW
very late if register allocation worked out.

Using MOVSX gives an opportunity to use the MOVSX as a both a
copy and a sign extend since the input and output register aren't
tied together.

Differential Revision: https://reviews.llvm.org/D67192

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371243 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelDAGToDAG.cpp
test/CodeGen/X86/2011-10-19-LegelizeLoad.ll
test/CodeGen/X86/div-rem-pair-recomposition-signed.ll
test/CodeGen/X86/divrem.ll
test/CodeGen/X86/divrem8_ext.ll
test/CodeGen/X86/scalar_widen_div.ll
test/CodeGen/X86/vector-idiv-sdiv-128.ll