mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 20:23:11 +01:00
[Hexagon] Reconsider getMask fix, return original mask, convert later
The getPayload/getMask/getPassThrough functions should return values that could be composed into a masked load/store without any additional type casts. The previous fix violated that. Instead, convert scalar mask to a vector right before rescaling.
This commit is contained in:
parent
313d9ab376
commit
577e1b0232
@ -416,8 +416,7 @@ auto AlignVectors::getMask(Value *Val) const -> Value * {
|
||||
int ElemCount = VecTy->getElementCount().getFixedValue();
|
||||
return HVC.getFullValue(HVC.getBoolTy(ElemCount));
|
||||
}
|
||||
// For scalars, return a vector <1 x i1>.
|
||||
return HVC.getFullValue(HVC.getBoolTy(1));
|
||||
return HVC.getFullValue(HVC.getBoolTy());
|
||||
}
|
||||
|
||||
auto AlignVectors::getPassThrough(Value *Val) const -> Value * {
|
||||
@ -811,14 +810,24 @@ auto AlignVectors::realignGroup(const MoveGroup &Move) const -> bool {
|
||||
// Stores.
|
||||
ByteSpan ASpanV, ASpanM;
|
||||
|
||||
// Return a vector value corresponding to the input value Val:
|
||||
// either <1 x Val> for scalar Val, or Val itself for vector Val.
|
||||
auto MakeVec = [](IRBuilder<> &Builder, Value *Val) -> Value * {
|
||||
Type *Ty = Val->getType();
|
||||
if (Ty->isVectorTy())
|
||||
return Val;
|
||||
auto *VecTy = VectorType::get(Ty, 1, /*Scalable*/ false);
|
||||
return Builder.CreateBitCast(Val, VecTy);
|
||||
};
|
||||
|
||||
for (int i = -1; i != NumSectors; ++i) {
|
||||
ByteSpan Section = VSpan.section(i * ScLen, ScLen).normalize();
|
||||
Value *AccumV = UndefValue::get(SecTy);
|
||||
Value *AccumM = HVC.getNullValue(SecTy);
|
||||
for (ByteSpan::Block &S : Section) {
|
||||
Value *Pay = getPayload(S.Seg.Val);
|
||||
Value *Mask = HVC.rescale(Builder, getMask(S.Seg.Val), Pay->getType(),
|
||||
HVC.getByteTy());
|
||||
Value *Mask = HVC.rescale(Builder, MakeVec(Builder, getMask(S.Seg.Val)),
|
||||
Pay->getType(), HVC.getByteTy());
|
||||
AccumM = HVC.insertb(Builder, AccumM, HVC.vbytes(Builder, Mask),
|
||||
S.Seg.Start, S.Seg.Size, S.Pos);
|
||||
AccumV = HVC.insertb(Builder, AccumV, HVC.vbytes(Builder, Pay),
|
||||
|
Loading…
Reference in New Issue
Block a user