Skip to content

Commit 4c349de

Browse files
[AIE2] Replace 8x8->8x8 & 8x4 ->4x8 tranpose shuffle vector with vshuffle
1 parent 4cf13dd commit 4c349de

File tree

2 files changed

+323
-167
lines changed

2 files changed

+323
-167
lines changed

llvm/lib/Target/AIE/AIE2PreLegalizerCombiner.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,32 @@ CombinerHelper::GeneratorType sectionGenerator(const int32_t From,
211211

212212
bool AIE2PreLegalizerCombinerImpl::tryCombineShuffleVector(
213213
MachineInstr &MI) const {
214+
const Register DstReg = MI.getOperand(0).getReg();
215+
const LLT DstTy = MRI.getType(DstReg);
216+
const LLT SrcTy = MRI.getType(MI.getOperand(1).getReg());
217+
const unsigned DstNumElts = DstTy.isVector() ? DstTy.getNumElements() : 1;
218+
const unsigned SrcNumElts = SrcTy.isVector() ? SrcTy.getNumElements() : 1;
219+
MachineIRBuilder MIB(MI);
220+
MachineRegisterInfo &MRI = *MIB.getMRI();
221+
214222
if (Helper.tryCombineShuffleVector(MI))
215223
return true;
216224

225+
const LLT V64S8 = LLT::fixed_vector(64, 8);
226+
CombinerHelper::GeneratorType FourPartitions =
227+
sectionGenerator(0, DstNumElts, 4, 1);
228+
if (Helper.matchCombineShuffleVector(MI, FourPartitions, DstNumElts))
229+
return createVShuffle(MI, V64S8, 35);
230+
231+
const LLT V32S16 = LLT::fixed_vector(32, 16);
232+
CombinerHelper::GeneratorType FourPartitionByTwo =
233+
sectionGenerator(0, DstNumElts, 4, 2);
234+
if (Helper.matchCombineShuffleVector(MI, FourPartitionByTwo, DstNumElts))
235+
return createVShuffle(MI, V32S16, 29);
236+
217237
return false;
218238
}
239+
219240
bool AIE2PreLegalizerCombinerImpl::tryCombineAll(MachineInstr &MI) const {
220241
if (tryCombineAllImpl(MI))
221242
return true;

0 commit comments

Comments
 (0)