From b05ea28f1f19dcd5b964c3a9a826d6eb2213ed42 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 17 Nov 2018 02:18:12 +0000 Subject: [PATCH] [X86] Use getUnpackl/getUnpackh instead of hardcoding a shuffle mask. llvm-svn: 347127 --- llvm/lib/Target/X86/X86ISelLowering.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 5d47d5f..7bf395a 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -23369,10 +23369,9 @@ static SDValue LowerMUL(SDValue Op, const X86Subtarget &Subtarget, // 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}; - SDValue ALo = DAG.getVectorShuffle(VT, dl, A, A, LoShufMask); - SDValue BLo = DAG.getVectorShuffle(VT, dl, B, B, LoShufMask); + SDValue Undef = DAG.getUNDEF(VT); + SDValue ALo = getUnpackl(DAG, dl, VT, A, Undef); + SDValue BLo = getUnpackl(DAG, dl, VT, B, Undef); ALo = DAG.getBitcast(ExVT, ALo); BLo = DAG.getBitcast(ExVT, BLo); @@ -23380,10 +23379,8 @@ static SDValue LowerMUL(SDValue Op, const X86Subtarget &Subtarget, // 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}; - SDValue AHi = DAG.getVectorShuffle(VT, dl, A, A, HiShufMask); - SDValue BHi = DAG.getVectorShuffle(VT, dl, B, B, HiShufMask); + SDValue AHi = getUnpackh(DAG, dl, VT, A, Undef); + SDValue BHi = getUnpackh(DAG, dl, VT, B, Undef); AHi = DAG.getBitcast(ExVT, AHi); BHi = DAG.getBitcast(ExVT, BHi); -- 2.7.4