[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


================
@@ -18149,6 +18139,16 @@ static SDValue performConcatVectorsCombine(SDNode *N,
     EVT N00VT = N00.getValueType();
     EVT N10VT = N10.getValueType();
 
+    // For extracted subvectors from the same original vectors, combine these
+    // into a single avg that operates on the two original vectors.
+    // avgceil is the target independant name for rhadd, avgfloor is a hadd.
+    // Example:
+    //  (concat_vectors (v8i8 (avgceils (extract_subvector (v16i8 OpA, <0>),
+    //                                   extract_subvector (v16i8 OpB, <0>))),
+    //                  (v8i8 (avgceils (extract_subvector (v16i8 OpA, <8>),
+    //                                   extract_subvector (v16i8 OpB, <8>)))))
+    // ->
+    //  (v16i8(avgceils(v16i8 OpA, v16i8 OpB)))
     if (N00->getOpcode() == ISD::EXTRACT_SUBVECTOR &&
----------------
davemgreen wrote:

Hmm. I was thinking we could remove this code now, as the new code subsumes it. It doesn't have the one-use-checks though, so maybe it is still useful? I think my preference would still be for removing it, unless it came up in any of the tests.

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


More information about the llvm-commits mailing list