[PATCH] D135145: [AMDGPU][GISel] Combine G_INSERT_VECTOR_ELT to G_SHUFFLE_VECTOR
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 12 08:28:06 PDT 2022
arsenm added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUCombine.td:48-52
+def insert_vec_elt_to_shuffle : GICombineRule<
+ (defs root:$insertelt, unsigned_matchinfo:$matchinfo),
+ (match (wip_match_opcode G_INSERT_VECTOR_ELT):$insertelt,
+ [{ return PreLegalizerHelper.matchInsertVectorEltToShuffle(*${insertelt}, ${matchinfo}); }]),
+ (apply [{ PreLegalizerHelper.applyInsertVectorEltToShuffle(*${insertelt}, ${matchinfo}); }])>;
----------------
This is generic
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp:162-164
+ // This is only beneficial if scalar pack insts are present.
+ if (!MI.getMF()->getSubtarget<GCNSubtarget>().hasScalarPackInsts())
+ return false;
----------------
The DAG treats this as an initial canonicalization, so the obvious codegen benefit isn't so important
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPreLegalizerCombiner.cpp:166-170
+ // TODO: Only on small vectors?
+ LLT VecTy = MRI.getType(MI.getOperand(0).getReg());
+ if (VecTy.getElementType() != LLT::scalar(16) ||
+ (VecTy.getSizeInBits() % 32) != 0)
+ return false;
----------------
Don't see why this would restrict the vector type
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135145/new/
https://reviews.llvm.org/D135145
More information about the llvm-commits
mailing list