if (CollectSingleShuffleElements(VecOp, LHS, RHS, Mask)) {
// If so, update the mask to reflect the inserted value.
if (EI->getOperand(0) == LHS) {
- Mask[InsertedIdx & (NumElts-1)] =
+ Mask[InsertedIdx % NumElts] =
ConstantInt::get(Type::Int32Ty, ExtractedIdx);
} else {
assert(EI->getOperand(0) == RHS);
- Mask[InsertedIdx & (NumElts-1)] =
+ Mask[InsertedIdx % NumElts] =
ConstantInt::get(Type::Int32Ty, ExtractedIdx+NumElts);
}
if (EI->getOperand(0) == RHS || RHS == 0) {
RHS = EI->getOperand(0);
Value *V = CollectShuffleElements(VecOp, Mask, RHS);
- Mask[InsertedIdx & (NumElts-1)] =
+ Mask[InsertedIdx % NumElts] =
ConstantInt::get(Type::Int32Ty, NumElts+ExtractedIdx);
return V;
}
Mask[i] = 2*e; // Turn into undef.
Elts.push_back(UndefValue::get(Type::Int32Ty));
} 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]));
}
}