[llvm] [AArch64] Convert concat(uhadd(a,b), uhadd(c,d)) to uhadd(concat(a,c), concat(b,d)) (PR #79464)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 06:31:21 PST 2024


================
@@ -18172,6 +18172,17 @@ static SDValue performConcatVectorsCombine(SDNode *N,
           return DAG.getNode(N0Opc, dl, VT, N00Source, N01Source);
       }
     }
+
+    // For a concat of two [u]avgfloors with a 128-bit destination size, combine
+    // into an avg of two contacts of the source vectors.
+    // eg: concat(uhadd(a,b), uhadd(c, d)) -> uhadd(concat(a, c), concat(b, d))
+    if (N0Opc == ISD::AVGFLOORU && VT.is128BitVector() && N0->hasOneUse() &&
----------------
davemgreen wrote:

This can apply to all the opcodes I think, not just AVGFLOORU. They should all work the same.

In the long run we could add other binary operators in too, but we should take this one step at a time and check that they perform well when we add them. For the moment we can add all four ceil/floor and u/s instructions.

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


More information about the llvm-commits mailing list