Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIE2] Combiners for 8x8->8x8 and 8x4->4x8 matrix transposes #76

Open
wants to merge 12 commits into
base: vvandebe.shufflevector.pattern.optimization
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions llvm/lib/Target/AIE/AIE2PreLegalizerCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,32 @@ CombinerHelper::GeneratorType sectionGenerator(const int32_t From,

bool AIE2PreLegalizerCombinerImpl::tryCombineShuffleVector(
MachineInstr &MI) const {
const Register DstReg = MI.getOperand(0).getReg();
const LLT DstTy = MRI.getType(DstReg);
const LLT SrcTy = MRI.getType(MI.getOperand(1).getReg());
const unsigned DstNumElts = DstTy.isVector() ? DstTy.getNumElements() : 1;
const unsigned SrcNumElts = SrcTy.isVector() ? SrcTy.getNumElements() : 1;
MachineIRBuilder MIB(MI);
MachineRegisterInfo &MRI = *MIB.getMRI();

if (Helper.tryCombineShuffleVector(MI))
return true;

const LLT V64S8 = LLT::fixed_vector(64, 8);
CombinerHelper::GeneratorType FourPartitions =
sectionGenerator(0, DstNumElts, 4, 1);
if (Helper.matchCombineShuffleVector(MI, FourPartitions, DstNumElts))
return createVShuffle(MI, V64S8, 35);

const LLT V32S16 = LLT::fixed_vector(32, 16);
CombinerHelper::GeneratorType FourPartitionByTwo =
sectionGenerator(0, DstNumElts, 4, 2);
if (Helper.matchCombineShuffleVector(MI, FourPartitionByTwo, DstNumElts))
return createVShuffle(MI, V32S16, 29);

return false;
}

bool AIE2PreLegalizerCombinerImpl::tryCombineAll(MachineInstr &MI) const {
if (tryCombineAllImpl(MI))
return true;
Expand Down
Loading