diff options
| author | Quentin Colombet <qcolombet@apple.com> | 2014-11-06 02:25:03 +0000 |
|---|---|---|
| committer | Quentin Colombet <qcolombet@apple.com> | 2014-11-06 02:25:03 +0000 |
| commit | dbe33e7aa41a0dfcdd826d2e4709f64975648729 (patch) | |
| tree | 87ca36118ffc3e9076d9a1617097c310ab8be723 /llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | |
| parent | 2dfef4bfd6673e9f25b6b06a880797880b8b3b6c (diff) | |
| download | bcm5719-llvm-dbe33e7aa41a0dfcdd826d2e4709f64975648729.tar.gz bcm5719-llvm-dbe33e7aa41a0dfcdd826d2e4709f64975648729.zip | |
[X86] Lower VSELECT into SHRUNKBLEND when we shrink the bits used into the
condition to match a blend.
This prevents optimizations that work on VSELECT to perform invalid
transformations. Indeed, the optimized condition does not match the vector
boolean content that is expected and bad things may happen.
This patch yields the exact same code on the whole test-suite + specs (-O3 and
-O3 -march=core-avx2), it improves one test case (vector-blend.ll) and fixes a
bug reduced in vselect-avx.ll.
<rdar://problem/18819506>
llvm-svn: 221429
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelDAGToDAG.cpp')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index 15b60ba5bf6..3ef7b2c7697 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -2131,6 +2131,16 @@ SDNode *X86DAGToDAGISel::Select(SDNode *Node) { case X86ISD::GlobalBaseReg: return getGlobalBaseReg(); + case X86ISD::SHRUNKBLEND: { + // SHRUNKBLEND selects like a regular VSELECT. + SDValue VSelect = CurDAG->getNode( + ISD::VSELECT, SDLoc(Node), Node->getValueType(0), Node->getOperand(0), + Node->getOperand(1), Node->getOperand(2)); + ReplaceUses(SDValue(Node, 0), VSelect); + SelectCode(VSelect.getNode()); + // We already called ReplaceUses. + return nullptr; + } case ISD::ATOMIC_LOAD_XOR: case ISD::ATOMIC_LOAD_AND: |

