diff options
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/X86/X86ISelLowering.cpp | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index f0981687a64..67f1a313f29 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -22449,42 +22449,26 @@ static SDValue LowerMUL(SDValue Op, const X86Subtarget &Subtarget, MVT ExVT = MVT::v8i16; // Extract the lo parts and sign extend to i16 - SDValue ALo, BLo; - if (Subtarget.hasSSE41()) { - ALo = DAG.getSignExtendVectorInReg(A, dl, ExVT); - BLo = DAG.getSignExtendVectorInReg(B, dl, ExVT); - } else { - // We're going to mask off the low byte of each result element of the - // pmullw, so it doesn't matter what's in the high byte of each 16-bit - // element. - const int ShufMask[] = {0, -1, 1, -1, 2, -1, 3, -1, + // We're going to mask off the low byte of each result element of the + // pmullw, so it doesn't matter what's in the high byte of each 16-bit + // element. + const int LoShufMask[] = {0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, -1, 6, -1, 7, -1}; - ALo = DAG.getVectorShuffle(VT, dl, A, A, ShufMask); - BLo = DAG.getVectorShuffle(VT, dl, B, B, ShufMask); - ALo = DAG.getBitcast(ExVT, ALo); - BLo = DAG.getBitcast(ExVT, BLo); - } + SDValue ALo = DAG.getVectorShuffle(VT, dl, A, A, LoShufMask); + SDValue BLo = DAG.getVectorShuffle(VT, dl, B, B, LoShufMask); + ALo = DAG.getBitcast(ExVT, ALo); + BLo = DAG.getBitcast(ExVT, BLo); // Extract the hi parts and sign extend to i16 - SDValue AHi, BHi; - if (Subtarget.hasSSE41()) { - const int ShufMask[] = {8, 9, 10, 11, 12, 13, 14, 15, - -1, -1, -1, -1, -1, -1, -1, -1}; - AHi = DAG.getVectorShuffle(VT, dl, A, A, ShufMask); - BHi = DAG.getVectorShuffle(VT, dl, B, B, ShufMask); - AHi = DAG.getSignExtendVectorInReg(AHi, dl, ExVT); - BHi = DAG.getSignExtendVectorInReg(BHi, dl, ExVT); - } else { - // We're going to mask off the low byte of each result element of the - // pmullw, so it doesn't matter what's in the high byte of each 16-bit - // element. - const int ShufMask[] = {8, -1, 9, -1, 10, -1, 11, -1, + // We're going to mask off the low byte of each result element of the + // pmullw, so it doesn't matter what's in the high byte of each 16-bit + // element. + const int HiShufMask[] = {8, -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, -1, 14, -1, 15, -1}; - AHi = DAG.getVectorShuffle(VT, dl, A, A, ShufMask); - BHi = DAG.getVectorShuffle(VT, dl, B, B, ShufMask); - AHi = DAG.getBitcast(ExVT, AHi); - BHi = DAG.getBitcast(ExVT, BHi); - } + SDValue AHi = DAG.getVectorShuffle(VT, dl, A, A, HiShufMask); + SDValue BHi = DAG.getVectorShuffle(VT, dl, B, B, HiShufMask); + AHi = DAG.getBitcast(ExVT, AHi); + BHi = DAG.getBitcast(ExVT, BHi); // Multiply, mask the lower 8bits of the lo/hi results and pack SDValue RLo = DAG.getNode(ISD::MUL, dl, ExVT, ALo, BLo); |