summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/SystemZ/SystemZISelLowering.cpp24
-rw-r--r--llvm/lib/Target/SystemZ/SystemZISelLowering.h8
2 files changed, 32 insertions, 0 deletions
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index adf368319dc..944284d0fb8 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -5496,6 +5496,30 @@ SDValue SystemZTargetLowering::PerformDAGCombine(SDNode *N,
return SDValue();
}
+void
+SystemZTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
+ KnownBits &Known,
+ const APInt &DemandedElts,
+ const SelectionDAG &DAG,
+ unsigned Depth) const {
+ unsigned BitWidth = Known.getBitWidth();
+
+ Known.resetAll();
+ switch (Op.getOpcode()) {
+ case SystemZISD::SELECT_CCMASK: {
+ KnownBits TrueKnown(BitWidth), FalseKnown(BitWidth);
+ DAG.computeKnownBits(Op.getOperand(0), TrueKnown, Depth + 1);
+ DAG.computeKnownBits(Op.getOperand(1), FalseKnown, Depth + 1);
+ Known.Zero = TrueKnown.Zero & FalseKnown.Zero;
+ Known.One = TrueKnown.One & FalseKnown.One;
+ break;
+ }
+
+ default:
+ break;
+ }
+}
+
//===----------------------------------------------------------------------===//
// Custom insertion
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.h b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
index 2cdc88db5a4..589ab9f602c 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.h
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.h
@@ -490,6 +490,14 @@ public:
SelectionDAG &DAG) const override;
SDValue PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const override;
+ /// Determine which of the bits specified in Mask are known to be either
+ /// zero or one and return them in the KnownZero/KnownOne bitsets.
+ void computeKnownBitsForTargetNode(const SDValue Op,
+ KnownBits &Known,
+ const APInt &DemandedElts,
+ const SelectionDAG &DAG,
+ unsigned Depth = 0) const override;
+
ISD::NodeType getExtendForAtomicOps() const override {
return ISD::ANY_EXTEND;
}
OpenPOWER on IntegriCloud