[llvm] [GISel][AMDGPU] Expand ShuffleVector (PR #124527)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 22:46:12 PST 2025


================
@@ -384,6 +384,45 @@ void CombinerHelper::applyCombineConcatVectors(
   MI.eraseFromParent();
 }
 
+bool CombinerHelper::matchCombineShuffleToBuildVector(MachineInstr &MI) const {
+  assert(MI.getOpcode() == TargetOpcode::G_SHUFFLE_VECTOR &&
+         "Invalid instruction");
+  auto &Shuffle = cast<GShuffleVector>(MI);
+
+  auto SrcVec1 = Shuffle.getSrc1Reg();
+  auto SrcVec2 = Shuffle.getSrc2Reg();
+
+  LLT SrcVec1Type = MRI.getType(SrcVec1);
+  LLT SrcVec2Type = MRI.getType(SrcVec2);
+  return SrcVec1Type.isVector() && SrcVec2Type.isVector();
+}
+
+void CombinerHelper::applyCombineShuffleToBuildVector(MachineInstr &MI) const {
+  auto &Shuffle = cast<GShuffleVector>(MI);
+
+  auto SrcVec1 = Shuffle.getSrc1Reg();
+  auto SrcVec2 = Shuffle.getSrc2Reg();
+  auto EltTy = MRI.getType(SrcVec1).getElementType();
+  auto Width = MRI.getType(SrcVec1).getNumElements();
----------------
arsenm wrote:

No auto 

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


More information about the llvm-commits mailing list