diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-05-08 00:57:18 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-05-08 00:57:18 +0000 |
commit | 7e2ff77ef05c23db6b9c82bc7a4110e170d7f94c (patch) | |
tree | 64720b94bfac0d0b7c77ad7005c71036d40b1d6b /lib/Target/X86/X86ISelDAGToDAG.cpp | |
parent | 687bcb2be07f675914e3a452fcc624bed8f53351 (diff) | |
download | llvm-7e2ff77ef05c23db6b9c82bc7a4110e170d7f94c.tar.gz llvm-7e2ff77ef05c23db6b9c82bc7a4110e170d7f94c.tar.bz2 llvm-7e2ff77ef05c23db6b9c82bc7a4110e170d7f94c.tar.xz |
Handle vector move / load which zero the destination register top bits (i.e. movd, movq, movss (addr), movsd (addr)) with X86 specific dag combine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50838 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86ISelDAGToDAG.cpp')
-rw-r--r-- | lib/Target/X86/X86ISelDAGToDAG.cpp | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/lib/Target/X86/X86ISelDAGToDAG.cpp b/lib/Target/X86/X86ISelDAGToDAG.cpp index 8286cd05a0..1e9a0da9c6 100644 --- a/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -975,38 +975,19 @@ bool X86DAGToDAGISel::SelectScalarSSELoad(SDOperand Op, SDOperand Pred, // Also handle the case where we explicitly require zeros in the top // elements. This is a vector shuffle from the zero vector. - if (N.getOpcode() == ISD::VECTOR_SHUFFLE && N.Val->hasOneUse() && + if (N.getOpcode() == X86ISD::ZEXT_VMOVL && N.Val->hasOneUse() && // Check to see if the top elements are all zeros (or bitcast of zeros). - ISD::isBuildVectorAllZeros(N.getOperand(0).Val) && - N.getOperand(1).getOpcode() == ISD::SCALAR_TO_VECTOR && - N.getOperand(1).Val->hasOneUse() && - ISD::isNON_EXTLoad(N.getOperand(1).getOperand(0).Val) && - N.getOperand(1).getOperand(0).hasOneUse()) { - // Check to see if the shuffle mask is 4/L/L/L or 2/L, where L is something - // from the LHS. - unsigned VecWidth=MVT::getVectorNumElements(N.getOperand(0).getValueType()); - SDOperand ShufMask = N.getOperand(2); - assert(ShufMask.getOpcode() == ISD::BUILD_VECTOR && "Invalid shuf mask!"); - if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(ShufMask.getOperand(0))) { - if (C->getValue() == VecWidth) { - for (unsigned i = 1; i != VecWidth; ++i) { - if (ShufMask.getOperand(i).getOpcode() == ISD::UNDEF) { - // ok. - } else { - ConstantSDNode *C = cast<ConstantSDNode>(ShufMask.getOperand(i)); - if (C->getValue() >= VecWidth) return false; - } - } - } - - // Okay, this is a zero extending load. Fold it. - LoadSDNode *LD = cast<LoadSDNode>(N.getOperand(1).getOperand(0)); - if (!SelectAddr(Op, LD->getBasePtr(), Base, Scale, Index, Disp)) - return false; - OutChain = LD->getChain(); - InChain = SDOperand(LD, 1); - return true; - } + N.getOperand(0).getOpcode() == ISD::SCALAR_TO_VECTOR && + N.getOperand(0).Val->hasOneUse() && + ISD::isNON_EXTLoad(N.getOperand(0).getOperand(0).Val) && + N.getOperand(0).getOperand(0).hasOneUse()) { + // Okay, this is a zero extending load. Fold it. + LoadSDNode *LD = cast<LoadSDNode>(N.getOperand(0).getOperand(0)); + if (!SelectAddr(Op, LD->getBasePtr(), Base, Scale, Index, Disp)) + return false; + OutChain = LD->getChain(); + InChain = SDOperand(LD, 1); + return true; } return false; } |