diff options
author | Evan Cheng <evan.cheng@apple.com> | 2008-02-18 23:04:32 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2008-02-18 23:04:32 +0000 |
commit | 6200c225e0ab09dfa66154c39dacfbefb0f9a99e (patch) | |
tree | 0ad268b8d99a79cc3b51f86ab6a3958a11f32ca6 /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | a6f63d94a5c0a9adaef66ee43d6d4938e66b83de (diff) | |
download | bcm5719-llvm-6200c225e0ab09dfa66154c39dacfbefb0f9a99e.tar.gz bcm5719-llvm-6200c225e0ab09dfa66154c39dacfbefb0f9a99e.zip |
- When DAG combiner is folding a bit convert into a BUILD_VECTOR, it should check if it's essentially a SCALAR_TO_VECTOR. Avoid turning (v8i16) <10, u, u, u> to <10, 0, u, u, u, u, u, u>. Instead, simply convert it to a SCALAR_TO_VECTOR of the proper type.
- X86 now normalize SCALAR_TO_VECTOR to (BIT_CONVERT (v4i32 SCALAR_TO_VECTOR)). Get rid of X86ISD::S2VEC.
llvm-svn: 47290
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index c12c98b4e39..f904fa16d58 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -176,6 +176,27 @@ bool ISD::isBuildVectorAllZeros(const SDNode *N) { return true; } +/// isScalarToVector - Return true if the specified node is a +/// ISD::SCALAR_TO_VECTOR node or a BUILD_VECTOR node where only the low +/// element is not an undef. +bool ISD::isScalarToVector(const SDNode *N) { + if (N->getOpcode() == ISD::SCALAR_TO_VECTOR) + return true; + + if (N->getOpcode() != ISD::BUILD_VECTOR) + return false; + if (N->getOperand(0).getOpcode() == ISD::UNDEF) + return false; + unsigned NumElems = N->getNumOperands(); + for (unsigned i = 1; i < NumElems; ++i) { + SDOperand V = N->getOperand(i); + if (V.getOpcode() != ISD::UNDEF) + return false; + } + return true; +} + + /// isDebugLabel - Return true if the specified node represents a debug /// label (i.e. ISD::LABEL or TargetInstrInfo::LABEL node and third operand /// is 0). |