Skip to content

Commit 0168e97

Browse files
committed
redo with isOperationLegalOrCustom
Change-Id: I4575a604fe5a76be2e657c63707c5fe25d631b98
1 parent 2fa38f3 commit 0168e97

4 files changed

Lines changed: 2 additions & 12 deletions

File tree

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3595,10 +3595,6 @@ class LLVM_ABI TargetLoweringBase {
35953595
return false;
35963596
}
35973597

3598-
/// Should usub.sat(X, 1) prefer the generic lowering X - zext(X != 0) over
3599-
/// the default overflow/select expansion?
3600-
virtual bool preferSubOfZextForUsubSatOne(EVT VT) const { return true; }
3601-
36023598
/// True if target has some particular form of dealing with pointer arithmetic
36033599
/// semantics for pointers with the given value type. False if pointer
36043600
/// arithmetic should not be preserved for passes such as instruction

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11475,8 +11475,9 @@ SDValue TargetLowering::expandAddSubSat(SDNode *Node, SelectionDAG &DAG) const {
1147511475
}
1147611476

1147711477
// usub.sat(a, 1) -> sub(a, zext(a != 0))
11478+
// Prefer this on targets without legal/cost-effective overflow-carry nodes.
1147811479
if (Opcode == ISD::USUBSAT && isOneOrOneSplat(RHS) &&
11479-
preferSubOfZextForUsubSatOne(VT)) {
11480+
!isOperationLegalOrCustom(ISD::USUBO_CARRY, VT)) {
1148011481
LHS = DAG.getFreeze(LHS);
1148111482
SDValue Zero = DAG.getConstant(0, dl, VT);
1148211483
EVT BoolVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30978,11 +30978,6 @@ bool AArch64TargetLowering::shouldConvertFpToSat(unsigned Op, EVT FPVT,
3097830978
return TargetLowering::shouldConvertFpToSat(Op, FPVT, VT);
3097930979
}
3098030980

30981-
bool AArch64TargetLowering::preferSubOfZextForUsubSatOne(EVT /*VT*/) const {
30982-
// See https://github.com/llvm/llvm-project/issues/191488
30983-
return false;
30984-
}
30985-
3098630981
bool AArch64TargetLowering::preferSelectsOverBooleanArithmetic(EVT VT) const {
3098730982
// Expand scalar and SVE operations using selects. Neon vectors prefer sub to
3098830983
// avoid vselect becoming bsl / unrolling.

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,6 @@ class AArch64TargetLowering : public TargetLowering {
450450

451451
bool shouldConvertFpToSat(unsigned Op, EVT FPVT, EVT VT) const override;
452452

453-
bool preferSubOfZextForUsubSatOne(EVT VT) const override;
454-
455453
bool preferSelectsOverBooleanArithmetic(EVT VT) const override;
456454

457455
bool isComplexDeinterleavingSupported() const override;

0 commit comments

Comments
 (0)