[llvm] [AArch64][GlobalISel] Combine G_EXTRACT_VECTOR_ELT and G_BUILD_VECTOR sequences into G_SHUFFLE_VECTOR (PR #110545)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 16:10:43 PDT 2024


================
@@ -4205,6 +4218,76 @@ void CombinerHelper::applyExtractVecEltBuildVec(MachineInstr &MI,
   replaceSingleDefInstWithReg(MI, Reg);
 }
 
+bool CombinerHelper::matchCombineExtractToShuffle(
+    MachineInstr &MI, SmallVectorImpl<Register> &Ops,
+    std::pair<Register, Register> &VectorRegisters) {
+  const GBuildVector *Build = cast<GBuildVector>(&MI);
+  const unsigned SrcNumElts =
+      MRI.getType(MI.getOperand(0).getReg()).getNumElements();
+
+  // This combine tries to find all the build vectors whose source elements
+  // all originate from a G_EXTRACT_VECTOR_ELT from one or two donor vectors.
+  // One example where this may happen is for AI chips where there are a lot
+  // of matrix multiplications. Typically there vectors are disected and then
----------------
ValentijnvdBeek wrote:

Removed

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


More information about the llvm-commits mailing list