[llvm] [AArch64] Convert UADDV(add(zext, zext)) into UADDLV(concat). (PR #78301)

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 09:45:53 PST 2024


================
@@ -16528,6 +16531,34 @@ static SDValue performUADDVAddCombine(SDValue A, SelectionDAG &DAG) {
     return DAG.getNode(Opcode, SDLoc(A), VT, Ext0.getOperand(0));
   };
 
+  // We can convert a UADDV(add(zext(64-bit source), zext(64-bit source))) into
+  // UADDLV(concat), where the concat represents the 64-bit zext sources.
+  auto DetectZextConcat = [&](SDValue A, SelectionDAG &DAG) {
+    // Look for add(zext(64-bit source), zext(64-bit source)), returning
+    // UADDLV(concat(zext, zext)) if found.
+    if (A.getOpcode() != ISD::ADD)
+      return SDValue();
+    EVT VT = A.getValueType();
+    if (VT != MVT::v4i32)
----------------
davemgreen wrote:

Can this apply to other typesizes too? Maybe v8i16, and v2i64 if that one applies?
You might need to be careful with the return type from a v8i16 as with the way the nodes work at the moment it will be a v4i32 that probably needs to be NVCAST back to the correct type.

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


More information about the llvm-commits mailing list