[llvm] 34caafe - [LLVM][CodeGen][AArch64] Simplify lowering for predicate inserts. (#89072)

via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 03:36:24 PDT 2024


Author: Paul Walker
Date: 2024-04-23T11:36:20+01:00
New Revision: 34caafe84ffd8588e717c92da358ad9368cc4fe5

URL: https://github.com/llvm/llvm-project/commit/34caafe84ffd8588e717c92da358ad9368cc4fe5
DIFF: https://github.com/llvm/llvm-project/commit/34caafe84ffd8588e717c92da358ad9368cc4fe5.diff

LOG: [LLVM][CodeGen][AArch64] Simplify lowering for predicate inserts. (#89072)

The original code has an invalid use of UZP1 because the result vector
type does not match its input vector types. Rather than insert extra nop
casts I figure it would be better to use CONCAT_VECTORS because that's
the operation we're performing.

NOTE: This is a step to enable more asserts in verifyTargetSDNode.

Added: 
    

Modified: 
    llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
index 3d1453e3beb9a1..2238015e43b173 100644
--- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -13896,16 +13896,14 @@ SDValue AArch64TargetLowering::LowerINSERT_SUBVECTOR(SDValue Op,
                        DAG.getVectorIdxConstant(0, DL));
       Hi = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, HalfVT, Vec0,
                        DAG.getVectorIdxConstant(NumElts / 2, DL));
-      if (Idx < (NumElts / 2)) {
-        SDValue NewLo = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, HalfVT, Lo, Vec1,
-                                    DAG.getVectorIdxConstant(Idx, DL));
-        return DAG.getNode(AArch64ISD::UZP1, DL, VT, NewLo, Hi);
-      } else {
-        SDValue NewHi =
-            DAG.getNode(ISD::INSERT_SUBVECTOR, DL, HalfVT, Hi, Vec1,
-                        DAG.getVectorIdxConstant(Idx - (NumElts / 2), DL));
-        return DAG.getNode(AArch64ISD::UZP1, DL, VT, Lo, NewHi);
-      }
+      if (Idx < (NumElts / 2))
+        Lo = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, HalfVT, Lo, Vec1,
+                         DAG.getVectorIdxConstant(Idx, DL));
+      else
+        Hi = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, HalfVT, Hi, Vec1,
+                         DAG.getVectorIdxConstant(Idx - (NumElts / 2), DL));
+
+      return DAG.getNode(ISD::CONCAT_VECTORS, DL, VT, Lo, Hi);
     }
 
     // Ensure the subvector is half the size of the main vector.


        


More information about the llvm-commits mailing list