@@ -822,10 +822,13 @@ ARMTargetLowering::ARMTargetLowering(const TargetMachine &TM,
822
822
setOperationAction(ISD::SRL, MVT::i64, Custom);
823
823
setOperationAction(ISD::SRA, MVT::i64, Custom);
824
824
825
- setOperationAction(ISD::ADDC, MVT::i32, Custom);
826
- setOperationAction(ISD::ADDE, MVT::i32, Custom);
827
- setOperationAction(ISD::SUBC, MVT::i32, Custom);
828
- setOperationAction(ISD::SUBE, MVT::i32, Custom);
825
+ if (!Subtarget->isThumb1Only()) {
826
+ // FIXME: We should do this for Thumb1 as well.
827
+ setOperationAction(ISD::ADDC, MVT::i32, Custom);
828
+ setOperationAction(ISD::ADDE, MVT::i32, Custom);
829
+ setOperationAction(ISD::SUBC, MVT::i32, Custom);
830
+ setOperationAction(ISD::SUBE, MVT::i32, Custom);
831
+ }
829
832
830
833
if (!Subtarget->isThumb1Only() && Subtarget->hasV6T2Ops())
831
834
setOperationAction(ISD::BITREVERSE, MVT::i32, Legal);
@@ -9093,45 +9096,19 @@ void ARMTargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
9093
9096
9094
9097
// Rename pseudo opcodes.
9095
9098
unsigned NewOpc = convertAddSubFlagsOpcode(MI.getOpcode());
9096
- unsigned ccOutIdx;
9097
9099
if (NewOpc) {
9098
9100
const ARMBaseInstrInfo *TII = Subtarget->getInstrInfo();
9099
9101
MCID = &TII->get(NewOpc);
9100
9102
9101
- assert(MCID->getNumOperands() ==
9102
- MI.getDesc().getNumOperands() + 5 - MI.getDesc().getSize()
9103
- && "converted opcode should be the same except for cc_out"
9104
- " (and, on Thumb1, pred)");
9103
+ assert(MCID->getNumOperands() == MI.getDesc().getNumOperands() + 1 &&
9104
+ "converted opcode should be the same except for cc_out");
9105
9105
9106
9106
MI.setDesc(*MCID);
9107
9107
9108
9108
// Add the optional cc_out operand
9109
9109
MI.addOperand(MachineOperand::CreateReg(0, /*isDef=*/true));
9110
-
9111
- // On Thumb1, move all input operands to the end, then add the predicate
9112
- if (Subtarget->isThumb1Only()) {
9113
- for (unsigned c = MCID->getNumOperands() - 4; c--;) {
9114
- MI.addOperand(MI.getOperand(1));
9115
- MI.RemoveOperand(1);
9116
- }
9117
-
9118
- // Restore the ties
9119
- for (unsigned i = MI.getNumOperands(); i--;) {
9120
- const MachineOperand& op = MI.getOperand(i);
9121
- if (op.isReg() && op.isUse()) {
9122
- int DefIdx = MCID->getOperandConstraint(i, MCOI::TIED_TO);
9123
- if (DefIdx != -1)
9124
- MI.tieOperands(DefIdx, i);
9125
- }
9126
- }
9127
-
9128
- MI.addOperand(MachineOperand::CreateImm(ARMCC::AL));
9129
- MI.addOperand(MachineOperand::CreateReg(0, /*isDef=*/false));
9130
- ccOutIdx = 1;
9131
- } else
9132
- ccOutIdx = MCID->getNumOperands() - 1;
9133
- } else
9134
- ccOutIdx = MCID->getNumOperands() - 1;
9110
+ }
9111
+ unsigned ccOutIdx = MCID->getNumOperands() - 1;
9135
9112
9136
9113
// Any ARM instruction that sets the 's' bit should specify an optional
9137
9114
// "cc_out" operand in the last operand position.
@@ -9162,9 +9139,7 @@ void ARMTargetLowering::AdjustInstrPostInstrSelection(MachineInstr &MI,
9162
9139
if (deadCPSR) {
9163
9140
assert(!MI.getOperand(ccOutIdx).getReg() &&
9164
9141
"expect uninitialized optional cc_out operand");
9165
- // Thumb1 instructions must have the S bit even if the CPSR is dead.
9166
- if (!Subtarget->isThumb1Only())
9167
- return;
9142
+ return;
9168
9143
}
9169
9144
9170
9145
// If this instruction was defined with an optional CPSR def and its dag node
@@ -9784,48 +9759,6 @@ static SDValue PerformUMLALCombine(SDNode *N, SelectionDAG &DAG,
9784
9759
return SDValue();
9785
9760
}
9786
9761
9787
- static SDValue PerformAddcSubcCombine(SDNode *N, SelectionDAG &DAG,
9788
- const ARMSubtarget *Subtarget) {
9789
- if (Subtarget->isThumb1Only()) {
9790
- SDValue RHS = N->getOperand(1);
9791
- if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(RHS)) {
9792
- int64_t imm = C->getSExtValue();
9793
- if (imm < 0) {
9794
- SDLoc DL(N);
9795
- RHS = DAG.getConstant(-imm, DL, MVT::i32);
9796
- unsigned Opcode = (N->getOpcode() == ARMISD::ADDC) ? ARMISD::SUBC
9797
- : ARMISD::ADDC;
9798
- return DAG.getNode(Opcode, DL, N->getVTList(), N->getOperand(0), RHS);
9799
- }
9800
- }
9801
- }
9802
- return SDValue();
9803
- }
9804
-
9805
- static SDValue PerformAddeSubeCombine(SDNode *N, SelectionDAG &DAG,
9806
- const ARMSubtarget *Subtarget) {
9807
- if (Subtarget->isThumb1Only()) {
9808
- SDValue RHS = N->getOperand(1);
9809
- if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(RHS)) {
9810
- int64_t imm = C->getSExtValue();
9811
- if (imm < 0) {
9812
- SDLoc DL(N);
9813
-
9814
- // The with-carry-in form matches bitwise not instead of the negation.
9815
- // Effectively, the inverse interpretation of the carry flag already
9816
- // accounts for part of the negation.
9817
- RHS = DAG.getConstant(~imm, DL, MVT::i32);
9818
-
9819
- unsigned Opcode = (N->getOpcode() == ARMISD::ADDE) ? ARMISD::SUBE
9820
- : ARMISD::ADDE;
9821
- return DAG.getNode(Opcode, DL, N->getVTList(),
9822
- N->getOperand(0), RHS, N->getOperand(2));
9823
- }
9824
- }
9825
- }
9826
- return SDValue();
9827
- }
9828
-
9829
9762
/// PerformADDECombine - Target-specific dag combine transform from
9830
9763
/// ARMISD::ADDC, ARMISD::ADDE, and ISD::MUL_LOHI to MLAL or
9831
9764
/// ARMISD::ADDC, ARMISD::ADDE and ARMISD::UMLAL to ARMISD::UMAAL
@@ -9834,7 +9767,7 @@ static SDValue PerformADDECombine(SDNode *N,
9834
9767
const ARMSubtarget *Subtarget) {
9835
9768
// Only ARM and Thumb2 support UMLAL/SMLAL.
9836
9769
if (Subtarget->isThumb1Only())
9837
- return PerformAddeSubeCombine(N, DCI.DAG, Subtarget );
9770
+ return SDValue( );
9838
9771
9839
9772
// Only perform the checks after legalize when the pattern is available.
9840
9773
if (DCI.isBeforeLegalize()) return SDValue();
@@ -11934,9 +11867,6 @@ SDValue ARMTargetLowering::PerformDAGCombine(SDNode *N,
11934
11867
case ISD::OR: return PerformORCombine(N, DCI, Subtarget);
11935
11868
case ISD::XOR: return PerformXORCombine(N, DCI, Subtarget);
11936
11869
case ISD::AND: return PerformANDCombine(N, DCI, Subtarget);
11937
- case ARMISD::ADDC:
11938
- case ARMISD::SUBC: return PerformAddcSubcCombine(N, DCI.DAG, Subtarget);
11939
- case ARMISD::SUBE: return PerformAddeSubeCombine(N, DCI.DAG, Subtarget);
11940
11870
case ARMISD::BFI: return PerformBFICombine(N, DCI);
11941
11871
case ARMISD::VMOVRRD: return PerformVMOVRRDCombine(N, DCI, Subtarget);
11942
11872
case ARMISD::VMOVDRR: return PerformVMOVDRRCombine(N, DCI.DAG);
0 commit comments