[llvm] [AArch64] Fold swapped sub/SUBS conditions (PR #121412)

David Green via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 18 04:05:07 PST 2025


================
@@ -24854,6 +24854,30 @@ static SDValue performCSELCombine(SDNode *N,
   if (SDValue Folded = foldCSELofCTTZ(N, DAG))
 		return Folded;
 
+  // CSEL a, b, cc, SUBS(x, y) -> CSEL a, b, swapped(cc), SUBS(y, x)
+  // if SUB(y, x) already exists and we can produce a swapped predicate for cc.
----------------
davemgreen wrote:

 It should be SUB(y,x). The SUBS is really a cmp from a icmp, and this commons the two.

https://github.com/llvm/llvm-project/pull/121412


More information about the llvm-commits mailing list