llvm.org GIT mirror llvm / 0789890
[DAGCombiner] Add vector demanded elements support to computeKnownBitsForTargetNode Follow up to D25691, this sets up the plumbing necessary to support vector demanded elements support in known bits calculations in target nodes. Differential Revision: https://reviews.llvm.org/D31249 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299201 91177308-0d34-0410-b5e6-96231b3b80d8 Simon Pilgrim 3 years ago
17 changed file(s) with 22 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
24202420 DAGCombinerInfo &DCI) const;
24212421
24222422 /// Determine which of the bits specified in Mask are known to be either zero
2423 /// or one and return them in the KnownZero/KnownOne bitsets.
2423 /// or one and return them in the KnownZero/KnownOne bitsets. The DemandedElts
2424 /// argument allows us to only collect the known bits that are shared by the
2425 /// requested vector elements.
24242426 virtual void computeKnownBitsForTargetNode(const SDValue Op,
24252427 APInt &KnownZero,
24262428 APInt &KnownOne,
2429 const APInt &DemandedElts,
24272430 const SelectionDAG &DAG,
24282431 unsigned Depth = 0) const;
24292432
19951995 /// them in the KnownZero/KnownOne bitsets. The DemandedElts argument allows
19961996 /// us to only collect the known bits that are shared by the requested vector
19971997 /// elements.
1998 /// TODO: We only support DemandedElts on a few opcodes so far, the remainder
1999 /// should be added when they become necessary.
20001998 void SelectionDAG::computeKnownBits(SDValue Op, APInt &KnownZero,
20011999 APInt &KnownOne, const APInt &DemandedElts,
20022000 unsigned Depth) const {
28132811 case ISD::INTRINSIC_W_CHAIN:
28142812 case ISD::INTRINSIC_VOID:
28152813 // Allow the target to implement this method for its nodes.
2816 TLI->computeKnownBitsForTargetNode(Op, KnownZero, KnownOne, *this, Depth);
2814 TLI->computeKnownBitsForTargetNode(Op, KnownZero, KnownOne, DemandedElts,
2815 *this, Depth);
28172816 break;
28182817 }
28192818
13221322 void TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
13231323 APInt &KnownZero,
13241324 APInt &KnownOne,
1325 const APInt &DemandedElts,
13251326 const SelectionDAG &DAG,
13261327 unsigned Depth) const {
13271328 assert((Op.getOpcode() >= ISD::BUILTIN_OP_END ||
791791 /// KnownZero/KnownOne bitsets.
792792 void AArch64TargetLowering::computeKnownBitsForTargetNode(
793793 const SDValue Op, APInt &KnownZero, APInt &KnownOne,
794 const SelectionDAG &DAG, unsigned Depth) const {
794 const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const {
795795 switch (Op.getOpcode()) {
796796 default:
797797 break;
250250 /// Determine which of the bits specified in Mask are known to be either zero
251251 /// or one and return them in the KnownZero/KnownOne bitsets.
252252 void computeKnownBitsForTargetNode(const SDValue Op, APInt &KnownZero,
253 APInt &KnownOne, const SelectionDAG &DAG,
253 APInt &KnownOne, const APInt &DemandedElts,
254 const SelectionDAG &DAG,
254255 unsigned Depth = 0) const override;
255256
256257 MVT getScalarShiftAmountTy(const DataLayout &DL, EVT) const override;
35553555
35563556 void AMDGPUTargetLowering::computeKnownBitsForTargetNode(
35573557 const SDValue Op, APInt &KnownZero, APInt &KnownOne,
3558 const SelectionDAG &DAG, unsigned Depth) const {
3558 const APInt &DemandedElts, const SelectionDAG &DAG, unsigned Depth) const {
35593559
35603560 unsigned BitWidth = KnownZero.getBitWidth();
35613561 KnownZero = KnownOne = APInt(BitWidth, 0); // Don't know anything.
201201 void computeKnownBitsForTargetNode(const SDValue Op,
202202 APInt &KnownZero,
203203 APInt &KnownOne,
204 const APInt &DemandedElts,
204205 const SelectionDAG &DAG,
205206 unsigned Depth = 0) const override;
206207
1260412604 void ARMTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
1260512605 APInt &KnownZero,
1260612606 APInt &KnownOne,
12607 const APInt &DemandedElts,
1260712608 const SelectionDAG &DAG,
1260812609 unsigned Depth) const {
1260912610 unsigned BitWidth = KnownOne.getBitWidth();
351351
352352 void computeKnownBitsForTargetNode(const SDValue Op, APInt &KnownZero,
353353 APInt &KnownOne,
354 const APInt &DemandedElts,
354355 const SelectionDAG &DAG,
355356 unsigned Depth) const override;
356357
1201612016 void PPCTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
1201712017 APInt &KnownZero,
1201812018 APInt &KnownOne,
12019 const APInt &DemandedElts,
1201912020 const SelectionDAG &DAG,
1202012021 unsigned Depth) const {
1202112022 KnownZero = KnownOne = APInt(KnownZero.getBitWidth(), 0);
603603 void computeKnownBitsForTargetNode(const SDValue Op,
604604 APInt &KnownZero,
605605 APInt &KnownOne,
606 const APInt &DemandedElts,
606607 const SelectionDAG &DAG,
607608 unsigned Depth = 0) const override;
608609
18761876 (const SDValue Op,
18771877 APInt &KnownZero,
18781878 APInt &KnownOne,
1879 const APInt &DemandedElts,
18791880 const SelectionDAG &DAG,
18801881 unsigned Depth) const {
18811882 APInt KnownZero2, KnownOne2;
6767 void computeKnownBitsForTargetNode(const SDValue Op,
6868 APInt &KnownZero,
6969 APInt &KnownOne,
70 const APInt &DemandedElts,
7071 const SelectionDAG &DAG,
7172 unsigned Depth = 0) const override;
7273
2666026660 void X86TargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
2666126661 APInt &KnownZero,
2666226662 APInt &KnownOne,
26663 const APInt &DemandedElts,
2666326664 const SelectionDAG &DAG,
2666426665 unsigned Depth) const {
2666526666 unsigned BitWidth = KnownZero.getBitWidth();
825825 void computeKnownBitsForTargetNode(const SDValue Op,
826826 APInt &KnownZero,
827827 APInt &KnownOne,
828 const APInt &DemandedElts,
828829 const SelectionDAG &DAG,
829830 unsigned Depth = 0) const override;
830831
18231823 void XCoreTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
18241824 APInt &KnownZero,
18251825 APInt &KnownOne,
1826 const APInt &DemandedElts,
18261827 const SelectionDAG &DAG,
18271828 unsigned Depth) const {
18281829 KnownZero = KnownOne = APInt(KnownZero.getBitWidth(), 0);
201201 void computeKnownBitsForTargetNode(const SDValue Op,
202202 APInt &KnownZero,
203203 APInt &KnownOne,
204 const APInt &DemandedElts,
204205 const SelectionDAG &DAG,
205206 unsigned Depth = 0) const override;
206207