[llvm] [DAG] Fold trunc(abdu(x, y)) and trunc(abds(x, y)) if they have sufficient leading zero/sign bits (PR #151471)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 1 01:17:10 PDT 2025


================
@@ -16275,6 +16317,10 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
   if (SDValue NewVSel = matchVSelectOpSizesWithSetCC(N))
     return NewVSel;
 
+  // fold trunc (ABDU/S A, B)) → ABDU/S (trunc A), (trunc B)
+  if (SDValue V = foldAbdToNarrowType(VT, N, SDLoc(N)))
----------------
RKSimon wrote:

better to handle these in the switch statement below - which is what its there for

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


More information about the llvm-commits mailing list