[llvm] [TargetLowering] Don't do abdu(lhs, rhs) -> sub(xor(sub(lhs, rhs), uo…f(lhs, rhs)), uof(lhs, rhs)) if it is not custom lowered (PR #156188)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 30 09:18:31 PDT 2025
https://github.com/AZero13 created https://github.com/llvm/llvm-project/pull/156188
Otherwise we deal with a lot of crazy expansions that could be handled by a select.
>From 6000cd78271aab3e440b26b82bddd2da63af14e9 Mon Sep 17 00:00:00 2001
From: AZero13 <gfunni234 at gmail.com>
Date: Sat, 30 Aug 2025 12:18:09 -0400
Subject: [PATCH] [TargetLowering] Don't do abdu(lhs, rhs) -> sub(xor(sub(lhs,
rhs), uof(lhs, rhs)), uof(lhs, rhs)) if it is not custom lowered
Otherwise we deal with a lot of crazy expansions that could be handled by a select.
---
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index 402a012e8e555..9a7379032766a 100644
--- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -9792,7 +9792,8 @@ SDValue TargetLowering::expandABD(SDNode *N, SelectionDAG &DAG) const {
// flag if the (scalar) type is illegal as this is more likely to legalize
// cleanly:
// abdu(lhs, rhs) -> sub(xor(sub(lhs, rhs), uof(lhs, rhs)), uof(lhs, rhs))
- if (!IsSigned && VT.isScalarInteger() && !isTypeLegal(VT)) {
+ if (!IsSigned && VT.isScalarInteger() && !isTypeLegal(VT) &&
+ isOperationCustom(ISD::USUBO, VT)) {
SDValue USubO =
DAG.getNode(ISD::USUBO, dl, DAG.getVTList(VT, MVT::i1), {LHS, RHS});
SDValue Cmp = DAG.getNode(ISD::SIGN_EXTEND, dl, VT, USubO.getValue(1));
More information about the llvm-commits
mailing list