[X86] Remove SRAs from v16i8 multiply lowering on sse2 targets
authorCraig Topper <craig.topper@intel.com>
Fri, 9 Mar 2018 01:22:31 +0000 (01:22 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 9 Mar 2018 01:22:31 +0000 (01:22 +0000)
commit784f1bbf5e51d041f2ea811a2d593e8dfad3033f
treed446d44b46e5ab34aecd2592d0127267fd5ef0ed
parent5b477be72a4eafe4ddd927589b8b4d962d379a3f
[X86] Remove SRAs from v16i8 multiply lowering on sse2 targets

Previously we unpacked the even bytes of each input into the high byte of 16-bit elements then did an v8i16 arithmetic shift right by 8 bits to fill the upper bits of each word with sign bits. Then we did the v8i16 multiply and then masked to zero the upper 8-bits of each result. The similar was done for all the odd bytes. The results are then packed together with packuswb

Since we are masking each multiply result element to 8-bits, and those 8-bits are determined only by the lower 8-bits of each of the inputs, we don't need to fill the upper bits with sign bits. So we can just unpack into the low byte of each element and treat the upper bits as garbage. This is what gcc also does.

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

llvm-svn: 327093
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/pmul.ll
llvm/test/CodeGen/X86/vector-idiv-sdiv-128.ll
llvm/test/CodeGen/X86/vector-idiv-udiv-128.ll