[X86][SSE] Use ISD::MULHS for constant vXi16 ISD::SRA lowering (PR38151)
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 26 Sep 2018 10:57:05 +0000 (10:57 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Wed, 26 Sep 2018 10:57:05 +0000 (10:57 +0000)
commit5beaac433dac39034fa85ca6fa785e86d3260ffa
treeffdc60b0dd5062cb40faf73b29b600eab373f4fa
parent75aca9409356366a7db618a1febfd26a62fcba93
[X86][SSE] Use ISD::MULHS for constant vXi16 ISD::SRA lowering (PR38151)

Similar to the existing ISD::SRL constant vector shifts from D49562, this patch adds ISD::SRA support with ISD::MULHS.

As we're dealing with signed values, we have to handle shift by zero and shift by one special cases, so XOP+AVX2/AVX512 splitting/extension is still a better solution - really we should still use ISD::MULHS if one of the special cases are used but for now I've just left a TODO and filtered by isKnownNeverZero.

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

llvm-svn: 343093
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/combine-sdiv.ll
llvm/test/CodeGen/X86/vector-shift-ashr-128.ll
llvm/test/CodeGen/X86/vector-shift-ashr-256.ll