mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
CostModel: initial checkin for code that estimates the cost of special shuffles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171180 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -18237,3 +18237,19 @@ unsigned X86VectorTargetTransformInfo::getCastInstrCost(unsigned Opcode,
|
|||||||
return VectorTargetTransformImpl::getCastInstrCost(Opcode, Dst, Src);
|
return VectorTargetTransformImpl::getCastInstrCost(Opcode, Dst, Src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned X86VectorTargetTransformInfo::getShuffleCost(ShuffleKind Kind, Type *Tp,
|
||||||
|
int Index) const {
|
||||||
|
// We only estimate the cost of reverse shuffles.
|
||||||
|
if (Kind != Reverse)
|
||||||
|
return VectorTargetTransformImpl::getShuffleCost(Kind, Tp, Index);
|
||||||
|
|
||||||
|
std::pair<unsigned, MVT> LT = getTypeLegalizationCost(Tp);
|
||||||
|
unsigned Cost = 1;
|
||||||
|
if (LT.second.getSizeInBits() > 128)
|
||||||
|
Cost = 3; // Extract + insert + copy.
|
||||||
|
|
||||||
|
// Multiple by the number of parts.
|
||||||
|
return Cost * LT.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -973,6 +973,8 @@ namespace llvm {
|
|||||||
|
|
||||||
virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
|
virtual unsigned getCastInstrCost(unsigned Opcode, Type *Dst,
|
||||||
Type *Src) const;
|
Type *Src) const;
|
||||||
|
|
||||||
|
unsigned getShuffleCost(ShuffleKind Kind, Type *Tp, int Index) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user