Skip to content

Commit c7c5042

Browse files
authored
Revert "[PowerPC] Add custom lowering for ssubo (#111748)" (#114672)
This reverts commit 8a0cb9a. Reverting due to PPC bootstrap bot failure.
1 parent 8a2113c commit c7c5042

File tree

3 files changed

+6
-43
lines changed

3 files changed

+6
-43
lines changed

llvm/lib/Target/PowerPC/PPCISelLowering.cpp

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,6 @@ PPCTargetLowering::PPCTargetLowering(const PPCTargetMachine &TM,
200200

201201
setOperationAction(ISD::UADDO, isPPC64 ? MVT::i64 : MVT::i32, Custom);
202202

203-
// On P10, the default lowering generates better code using the
204-
// setbc instruction.
205-
if (!Subtarget.hasP10Vector() && isPPC64)
206-
setOperationAction(ISD::SSUBO, MVT::i32, Custom);
207-
208203
// Match BITREVERSE to customized fast code sequence in the td file.
209204
setOperationAction(ISD::BITREVERSE, MVT::i32, Legal);
210205
setOperationAction(ISD::BITREVERSE, MVT::i64, Legal);
@@ -12021,36 +12016,6 @@ SDValue PPCTargetLowering::LowerUaddo(SDValue Op, SelectionDAG &DAG) const {
1202112016
return Res;
1202212017
}
1202312018

12024-
SDValue PPCTargetLowering::LowerSSUBO(SDValue Op, SelectionDAG &DAG) const {
12025-
12026-
SDLoc dl(Op);
12027-
12028-
SDValue LHS64 = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i64, Op.getOperand(0));
12029-
SDValue RHS64 = DAG.getNode(ISD::ANY_EXTEND, dl, MVT::i64, Op.getOperand(1));
12030-
12031-
SDValue Sub = DAG.getNode(ISD::SUB, dl, MVT::i64, LHS64, RHS64);
12032-
12033-
SDValue Extsw = DAG.getNode(ISD::SIGN_EXTEND_INREG, dl, MVT::i64, Sub,
12034-
DAG.getValueType(MVT::i32));
12035-
12036-
SDValue Xor = DAG.getNode(ISD::XOR, dl, MVT::i64, Extsw, Sub);
12037-
12038-
SDValue Addic = DAG.getNode(ISD::ADDC, dl, DAG.getVTList(MVT::i64, MVT::Glue),
12039-
Xor, DAG.getConstant(-1, dl, MVT::i64));
12040-
12041-
SDValue Overflow =
12042-
DAG.getNode(ISD::SUBE, dl, DAG.getVTList(MVT::i64, MVT::Glue), Xor, Addic,
12043-
Addic.getValue(1));
12044-
12045-
SDValue OverflowTrunc =
12046-
DAG.getNode(ISD::TRUNCATE, dl, Op.getNode()->getValueType(1), Overflow);
12047-
SDValue SubTrunc =
12048-
(Sub->getValueType(0) != Op.getNode()->getValueType(0))
12049-
? DAG.getNode(ISD::TRUNCATE, dl, Op.getNode()->getValueType(0), Sub)
12050-
: Sub;
12051-
return DAG.getMergeValues({SubTrunc, OverflowTrunc}, dl);
12052-
}
12053-
1205412019
/// LowerOperation - Provide custom lowering hooks for some operations.
1205512020
///
1205612021
SDValue PPCTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
@@ -12073,8 +12038,6 @@ SDValue PPCTargetLowering::LowerOperation(SDValue Op, SelectionDAG &DAG) const {
1207312038
case ISD::SETCC: return LowerSETCC(Op, DAG);
1207412039
case ISD::INIT_TRAMPOLINE: return LowerINIT_TRAMPOLINE(Op, DAG);
1207512040
case ISD::ADJUST_TRAMPOLINE: return LowerADJUST_TRAMPOLINE(Op, DAG);
12076-
case ISD::SSUBO:
12077-
return LowerSSUBO(Op, DAG);
1207812041

1207912042
case ISD::INLINEASM:
1208012043
case ISD::INLINEASM_BR: return LowerINLINEASM(Op, DAG);

llvm/lib/Target/PowerPC/PPCISelLowering.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,6 @@ namespace llvm {
12791279
SDValue LowerJumpTable(SDValue Op, SelectionDAG &DAG) const;
12801280
SDValue LowerUaddo(SDValue Op, SelectionDAG &DAG) const;
12811281
SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
1282-
SDValue LowerSSUBO(SDValue Op, SelectionDAG &DAG) const;
12831282
SDValue LowerINIT_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
12841283
SDValue LowerADJUST_TRAMPOLINE(SDValue Op, SelectionDAG &DAG) const;
12851284
SDValue LowerINLINEASM(SDValue Op, SelectionDAG &DAG) const;

llvm/test/CodeGen/PowerPC/saddo-ssubo.ll

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,12 @@ entry:
129129
define i1 @test_ssubo_i32(i32 %a, i32 %b) nounwind {
130130
; CHECK-LABEL: test_ssubo_i32:
131131
; CHECK: # %bb.0: # %entry
132-
; CHECK-NEXT: sub 3, 3, 4
133-
; CHECK-NEXT: extsw 4, 3
134-
; CHECK-NEXT: xor 3, 4, 3
135-
; CHECK-NEXT: addic 4, 3, -1
136-
; CHECK-NEXT: subfe 3, 4, 3
132+
; CHECK-NEXT: sub 5, 3, 4
133+
; CHECK-NEXT: cmpwi 1, 4, 0
134+
; CHECK-NEXT: cmpw 5, 3
135+
; CHECK-NEXT: li 3, 1
136+
; CHECK-NEXT: creqv 20, 5, 0
137+
; CHECK-NEXT: isel 3, 0, 3, 20
137138
; CHECK-NEXT: blr
138139
entry:
139140
%res = call { i32, i1 } @llvm.ssub.with.overflow.i32(i32 %a, i32 %b) nounwind

0 commit comments

Comments
 (0)