Fixing buggy code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27239 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2006-03-28 23:41:33 +00:00
parent f065a6f711
commit 36b27f3cde

View File

@ -1571,14 +1571,14 @@ unsigned X86::getShuffleSHUFImmediate(SDNode *N) {
unsigned NumOperands = N->getNumOperands();
unsigned Shift = (NumOperands == 4) ? 2 : 1;
unsigned Mask = 0;
unsigned i = NumOperands - 1;
do {
unsigned Val = cast<ConstantSDNode>(N->getOperand(i))->getValue();
for (unsigned i = 0; i < NumOperands; ++i) {
unsigned Val
= cast<ConstantSDNode>(N->getOperand(NumOperands-i-1))->getValue();
if (Val >= NumOperands) Val -= NumOperands;
Mask |= Val;
Mask <<= Shift;
--i;
} while (i != 0);
if (i != NumOperands - 1)
Mask <<= Shift;
}
return Mask;
}