[llvm] r322986 - [SystemZ] Implement computeKnownBitsForTargetNode
Ulrich Weigand via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 19 12:49:06 PST 2018
Author: uweigand
Date: Fri Jan 19 12:49:05 2018
New Revision: 322986
URL: http://llvm.org/viewvc/llvm-project?rev=322986&view=rev
Log:
[SystemZ] Implement computeKnownBitsForTargetNode
This provides a computeKnownBits implementation for SystemZ target
nodes. Currently only SystemZISD::SELECT_CCMASK is supported.
Modified:
llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h
Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=322986&r1=322985&r2=322986&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Fri Jan 19 12:49:05 2018
@@ -5496,6 +5496,30 @@ SDValue SystemZTargetLowering::PerformDA
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
//===----------------------------------------------------------------------===//
Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h?rev=322986&r1=322985&r2=322986&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.h Fri Jan 19 12:49:05 2018
@@ -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;
}
More information about the llvm-commits
mailing list