[llvm-commits] [llvm] r55035 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Mon P Wang
wangmp at apple.com
Tue Aug 19 19:23:26 PDT 2008
Author: wangmp
Date: Tue Aug 19 21:23:25 2008
New Revision: 55035
URL: http://llvm.org/viewvc/llvm-project?rev=55035&view=rev
Log:
Fixed shuffle optimizations to handle non power of 2 vectors
Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=55035&r1=55034&r2=55035&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Tue Aug 19 21:23:25 2008
@@ -11106,11 +11106,11 @@
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 @@
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 @@
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]));
}
}
More information about the llvm-commits
mailing list