[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)
commit7bb433c87b602a181a9e6ee08e38717a63b6f478
tree11bca5d9b01b6e20aa19be3856f35300f8cf9804
parent22b35c4291d2d90db27cac4ccf5c21f619ff49af
[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

llvm-svn: 371243
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
llvm/test/CodeGen/X86/2011-10-19-LegelizeLoad.ll
llvm/test/CodeGen/X86/div-rem-pair-recomposition-signed.ll
llvm/test/CodeGen/X86/divrem.ll
llvm/test/CodeGen/X86/divrem8_ext.ll
llvm/test/CodeGen/X86/scalar_widen_div.ll
llvm/test/CodeGen/X86/vector-idiv-sdiv-128.ll