mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 06:25:18 +00:00
Fix issues in shuffle decoding around VPERM* instructions. Fix shuffle decoding for VSHUFPS/D for 256-bit types. Add pattern matching for memory forms of VPERMILPS/VPERMILPD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145390 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -128,17 +128,27 @@ void DecodePUNPCKHMask(unsigned NElts,
|
||||
}
|
||||
}
|
||||
|
||||
void DecodeSHUFPSMask(unsigned NElts, unsigned Imm,
|
||||
SmallVectorImpl<unsigned> &ShuffleMask) {
|
||||
// Part that reads from dest.
|
||||
for (unsigned i = 0; i != NElts/2; ++i) {
|
||||
ShuffleMask.push_back(Imm % NElts);
|
||||
Imm /= NElts;
|
||||
}
|
||||
// Part that reads from src.
|
||||
for (unsigned i = 0; i != NElts/2; ++i) {
|
||||
ShuffleMask.push_back(Imm % NElts + NElts);
|
||||
Imm /= NElts;
|
||||
void DecodeSHUFPMask(EVT VT, unsigned Imm,
|
||||
SmallVectorImpl<unsigned> &ShuffleMask) {
|
||||
unsigned NumElts = VT.getVectorNumElements();
|
||||
|
||||
unsigned NumLanes = VT.getSizeInBits() / 128;
|
||||
unsigned NumLaneElts = NumElts / NumLanes;
|
||||
|
||||
int NewImm = Imm;
|
||||
for (unsigned l = 0; l < NumLanes; ++l) {
|
||||
unsigned LaneStart = l * NumLaneElts;
|
||||
// Part that reads from dest.
|
||||
for (unsigned i = 0; i != NumLaneElts/2; ++i) {
|
||||
ShuffleMask.push_back(NewImm % NumLaneElts + LaneStart);
|
||||
NewImm /= NumLaneElts;
|
||||
}
|
||||
// Part that reads from src.
|
||||
for (unsigned i = 0; i != NumLaneElts/2; ++i) {
|
||||
ShuffleMask.push_back(NewImm % NumLaneElts + NumElts + LaneStart);
|
||||
NewImm /= NumLaneElts;
|
||||
}
|
||||
if (NumLaneElts == 4) NewImm = Imm; // reload imm
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user