Skip to content

Commit eb99c5c

Browse files
committed
redo with isOperationLegalOrCustom
Change-Id: I4575a604fe5a76be2e657c63707c5fe25d631b98
1 parent 678480a commit eb99c5c

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
@@ -3596,10 +3596,6 @@ class LLVM_ABI TargetLoweringBase {
35963596
return false;
35973597
}
35983598

3599-
/// Should usub.sat(X, 1) prefer the generic lowering X - zext(X != 0) over
3600-
/// the default overflow/select expansion?
3601-
virtual bool preferSubOfZextForUsubSatOne(EVT VT) const { return true; }
3602-
36033599
/// True if target has some particular form of dealing with pointer arithmetic
36043600
/// semantics for pointers with the given value type. False if pointer
36053601
/// 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
@@ -31035,11 +31035,6 @@ bool AArch64TargetLowering::shouldConvertFpToSat(unsigned Op, EVT FPVT,
3103531035
return TargetLowering::shouldConvertFpToSat(Op, FPVT, VT);
3103631036
}
3103731037

31038-
bool AArch64TargetLowering::preferSubOfZextForUsubSatOne(EVT /*VT*/) const {
31039-
// See https://github.com/llvm/llvm-project/issues/191488
31040-
return false;
31041-
}
31042-
3104331038
bool AArch64TargetLowering::preferSelectsOverBooleanArithmetic(EVT VT) const {
3104431039
// Expand scalar and SVE operations using selects. Neon vectors prefer sub to
3104531040
// 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)