summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-01-11 04:02:23 +0000
committerCraig Topper <craig.topper@gmail.com>2017-01-11 04:02:23 +0000
commit577d2585692ebce959aecd3d997cfe9b0e045fc0 (patch)
tree83f75385b20e501921665c99de4c69f206243266 /llvm/lib/CodeGen
parentba1b5c98ba941b4382fc26bcf6b410c3120c22d9 (diff)
downloadbcm5719-llvm-577d2585692ebce959aecd3d997cfe9b0e045fc0.tar.gz
bcm5719-llvm-577d2585692ebce959aecd3d997cfe9b0e045fc0.zip
[DAGCombiner] Teach DAG combiner to fold (vselect (N0 xor AllOnes), N1, N2) -> (vselect N0, N2, N1). Only do this if the target indicates its vector boolean type is ZeroOrNegativeOneBooleanContent.
llvm-svn: 291645
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 680f62fa91b..2f603628916 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -5966,6 +5966,15 @@ SDValue DAGCombiner::visitVSELECT(SDNode *N) {
return CV;
}
+ // Fold (vselect (N0 xor AllOnes), N1, N2) -> (vselect N0, N2, N1)
+ if (N0.getOpcode() == ISD::XOR &&
+ ISD::isBuildVectorAllOnes(N0.getOperand(1).getNode()) &&
+ TLI.getBooleanContents(N0.getValueType()) ==
+ TargetLowering::ZeroOrNegativeOneBooleanContent) {
+ EVT VT = N->getValueType(0);
+ return DAG.getNode(ISD::VSELECT, DL, VT, N0.getOperand(0), N2, N1);
+ }
+
return SDValue();
}
OpenPOWER on IntegriCloud