summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorSimon Pilgrim <llvm-dev@redking.me.uk>2018-12-16 13:33:37 +0000
committerSimon Pilgrim <llvm-dev@redking.me.uk>2018-12-16 13:33:37 +0000
commit0ef977b83dae860f0c00a1f23eaaefeb82913b7e (patch)
tree34fa58c997877dd3c62ec2880154289cad749bab /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parent780b3ca775852acacc4313e8d7ff9238184d7df2 (diff)
downloadbcm5719-llvm-0ef977b83dae860f0c00a1f23eaaefeb82913b7e.tar.gz
bcm5719-llvm-0ef977b83dae860f0c00a1f23eaaefeb82913b7e.zip
[SelectionDAG] Add FSHL/FSHR support to computeKnownBits
Also exposes an issue in DAGCombiner::visitFunnelShift where we were assuming the shift amount had the result type (after legalization it'll have the targets shift amount type). llvm-svn: 349298
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index cad130ecea6..93a1ab1dcff 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -6966,8 +6966,10 @@ SDValue DAGCombiner::visitFunnelShift(SDNode *N) {
// fold (fshl N0, N1, 0) -> N0
// fold (fshr N0, N1, 0) -> N1
- if (DAG.MaskedValueIsZero(N2, APInt::getAllOnesValue(BitWidth)))
- return IsFSHL ? N0 : N1;
+ if (isPowerOf2_32(BitWidth))
+ if (DAG.MaskedValueIsZero(
+ N2, APInt(N2.getScalarValueSizeInBits(), BitWidth - 1)))
+ return IsFSHL ? N0 : N1;
// fold (fsh* N0, N1, c) -> (fsh* N0, N1, c % BitWidth)
if (ConstantSDNode *Cst = isConstOrConstSplat(N2)) {
OpenPOWER on IntegriCloud