diff options
author | Dale Johannesen <dalej@apple.com> | 2009-06-01 23:27:20 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-06-01 23:27:20 +0000 |
commit | 4150d83abe90a5da4ddf86433b7bf4329acfa57c (patch) | |
tree | f6d49f1a1eadb573ca9969173c76b891c035eb53 /lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 83138998513faed0c1d31e712ac6e6d5e6ee8d91 (diff) |
Make the implicit inputs and outputs of target-independent
ADDC/ADDE use MVT::i1 (later, whatever it gets legalized to)
instead of MVT::Flag. Remove CARRY_FALSE in favor of 0; adjust
all target-independent code to use this format.
Most targets will still produce a Flag-setting target-dependent
version when selection is done. X86 is converted to use i32
instead, which means TableGen needs to produce different code
in xxxGenDAGISel.inc. This keys off the new supportsHasI1 bit
in xxxInstrInfo, currently set only for X86; in principle this
is temporary and should go away when all other targets have
been converted. All relevant X86 instruction patterns are
modified to represent setting and using EFLAGS explicitly. The
same can be done on other targets.
The immediate behavior change is that an ADC/ADD pair are no
longer tightly coupled in the X86 scheduler; they can be
separated by instructions that don't clobber the flags (MOV).
I will soon add some peephole optimizations based on using
other instructions that set the flags to feed into ADC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72707 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 4c1710dd81..e1554bf33b 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -1085,8 +1085,7 @@ SDValue DAGCombiner::visitADDC(SDNode *N) { // If the flag result is dead, turn this into an ADD. if (N->hasNUsesOfValue(0, 1)) return CombineTo(N, DAG.getNode(ISD::ADD, N->getDebugLoc(), VT, N1, N0), - DAG.getNode(ISD::CARRY_FALSE, - N->getDebugLoc(), MVT::Flag)); + DAG.getConstant(0, N->getValueType(1))); // canonicalize constant to RHS. if (N0C && !N1C) @@ -1094,10 +1093,9 @@ SDValue DAGCombiner::visitADDC(SDNode *N) { // fold (addc x, 0) -> x + no carry out if (N1C && N1C->isNullValue()) - return CombineTo(N, N0, DAG.getNode(ISD::CARRY_FALSE, - N->getDebugLoc(), MVT::Flag)); + return CombineTo(N, N0, DAG.getConstant(0, N1.getValueType())); - // fold (addc a, b) -> (or a, b), CARRY_FALSE iff a and b share no bits. + // fold (addc a, b) -> (or a, b), 0 iff a and b share no bits. APInt LHSZero, LHSOne; APInt RHSZero, RHSOne; APInt Mask = APInt::getAllOnesValue(VT.getSizeInBits()); @@ -1111,8 +1109,7 @@ SDValue DAGCombiner::visitADDC(SDNode *N) { if ((RHSZero & (~LHSZero & Mask)) == (~LHSZero & Mask) || (LHSZero & (~RHSZero & Mask)) == (~RHSZero & Mask)) return CombineTo(N, DAG.getNode(ISD::OR, N->getDebugLoc(), VT, N0, N1), - DAG.getNode(ISD::CARRY_FALSE, - N->getDebugLoc(), MVT::Flag)); + DAG.getConstant(0, N1.getValueType())); } return SDValue(); @@ -1131,8 +1128,9 @@ SDValue DAGCombiner::visitADDE(SDNode *N) { N1, N0, CarryIn); // fold (adde x, y, false) -> (addc x, y) - if (CarryIn.getOpcode() == ISD::CARRY_FALSE) - return DAG.getNode(ISD::ADDC, N->getDebugLoc(), N->getVTList(), N1, N0); + if (ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(CarryIn)) + if (N2C->getAPIntValue()==0) + return DAG.getNode(ISD::ADDC, N->getDebugLoc(), N->getVTList(), N1, N0); return SDValue(); } |