mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 06:30:16 +00:00
Fixed shuffle optimizations to handle non power of 2 vectors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55035 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ba6783ec8c
commit
4f5ca2cf80
@ -11106,11 +11106,11 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS,
|
|||||||
if (CollectSingleShuffleElements(VecOp, LHS, RHS, Mask)) {
|
if (CollectSingleShuffleElements(VecOp, LHS, RHS, Mask)) {
|
||||||
// If so, update the mask to reflect the inserted value.
|
// If so, update the mask to reflect the inserted value.
|
||||||
if (EI->getOperand(0) == LHS) {
|
if (EI->getOperand(0) == LHS) {
|
||||||
Mask[InsertedIdx & (NumElts-1)] =
|
Mask[InsertedIdx % NumElts] =
|
||||||
ConstantInt::get(Type::Int32Ty, ExtractedIdx);
|
ConstantInt::get(Type::Int32Ty, ExtractedIdx);
|
||||||
} else {
|
} else {
|
||||||
assert(EI->getOperand(0) == RHS);
|
assert(EI->getOperand(0) == RHS);
|
||||||
Mask[InsertedIdx & (NumElts-1)] =
|
Mask[InsertedIdx % NumElts] =
|
||||||
ConstantInt::get(Type::Int32Ty, ExtractedIdx+NumElts);
|
ConstantInt::get(Type::Int32Ty, ExtractedIdx+NumElts);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -11159,7 +11159,7 @@ static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask,
|
|||||||
if (EI->getOperand(0) == RHS || RHS == 0) {
|
if (EI->getOperand(0) == RHS || RHS == 0) {
|
||||||
RHS = EI->getOperand(0);
|
RHS = EI->getOperand(0);
|
||||||
Value *V = CollectShuffleElements(VecOp, Mask, RHS);
|
Value *V = CollectShuffleElements(VecOp, Mask, RHS);
|
||||||
Mask[InsertedIdx & (NumElts-1)] =
|
Mask[InsertedIdx % NumElts] =
|
||||||
ConstantInt::get(Type::Int32Ty, NumElts+ExtractedIdx);
|
ConstantInt::get(Type::Int32Ty, NumElts+ExtractedIdx);
|
||||||
return V;
|
return V;
|
||||||
}
|
}
|
||||||
@ -11313,7 +11313,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
|
|||||||
Mask[i] = 2*e; // Turn into undef.
|
Mask[i] = 2*e; // Turn into undef.
|
||||||
Elts.push_back(UndefValue::get(Type::Int32Ty));
|
Elts.push_back(UndefValue::get(Type::Int32Ty));
|
||||||
} else {
|
} else {
|
||||||
Mask[i] &= (e-1); // Force to LHS.
|
Mask[i] = Mask[i] % e; // Force to LHS.
|
||||||
Elts.push_back(ConstantInt::get(Type::Int32Ty, Mask[i]));
|
Elts.push_back(ConstantInt::get(Type::Int32Ty, Mask[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user