summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2008-08-20 02:23:25 +0000
committerMon P Wang <wangmp@apple.com>2008-08-20 02:23:25 +0000
commit1b2c061b73ec0da3fbb0edd90a258c80b1431603 (patch)
treefccab9dc77d59f6b940732e32b33cc8192032b4e /llvm/lib/Transforms
parentb93b489c54394b299f211588a71a3373305357e0 (diff)
downloadbcm5719-llvm-1b2c061b73ec0da3fbb0edd90a258c80b1431603.tar.gz
bcm5719-llvm-1b2c061b73ec0da3fbb0edd90a258c80b1431603.zip
Fixed shuffle optimizations to handle non power of 2 vectors
llvm-svn: 55035
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index a517d941c9a..403d6aad3b1 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -11106,11 +11106,11 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS,
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);
}
@@ -11159,7 +11159,7 @@ static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask,
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;
}
@@ -11313,7 +11313,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
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]));
}
}
OpenPOWER on IntegriCloud