From 9293451e3f42aba03676dbbb029032e286cac4dd Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Sun, 23 Apr 2006 06:35:19 +0000 Subject: [PATCH] MOVL shuffle (i.e. movd or movss / movsd from memory) of undef, V2 == V2 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27953 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86ISelLowering.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 3861fc35940..8d52c56f072 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -2973,6 +2973,8 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { SDOperand PermMask = Op.getOperand(2); MVT::ValueType VT = Op.getValueType(); unsigned NumElems = PermMask.getNumOperands(); + bool V1IsUndef = V1.getOpcode() == ISD::UNDEF; + bool V2IsUndef = V2.getOpcode() == ISD::UNDEF; if (isSplatMask(PermMask.Val)) { if (NumElems <= 4) return Op; @@ -2980,8 +2982,10 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { return PromoteSplat(Op, DAG); } - if (X86::isMOVLMask(PermMask.Val) || - X86::isMOVSHDUPMask(PermMask.Val) || + if (X86::isMOVLMask(PermMask.Val)) + return (V1IsUndef) ? V2 : Op; + + if (X86::isMOVSHDUPMask(PermMask.Val) || X86::isMOVSLDUPMask(PermMask.Val) || X86::isMOVHLPSMask(PermMask.Val) || X86::isMOVHPMask(PermMask.Val) || @@ -3003,6 +3007,7 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { } if (isCommutedMOVL(PermMask.Val, V2IsSplat)) { + if (V2IsUndef) return V1; Op = CommuteVectorShuffle(Op, DAG); V1 = Op.getOperand(0); V2 = Op.getOperand(1); -- 2.34.1