Fix silly bug in vector scale extraction optimization.

(Introduced in f20a2d2ee.  How did this ever pass tests?)
This commit is contained in:
Matt Pharr
2012-02-13 12:06:45 -08:00
parent 73bf552cd6
commit e864447e4a

View File

@@ -1443,7 +1443,7 @@ lExtract248Scale(llvm::Value *splatOperand, int splatValue,
Assert(insertBefore != NULL); Assert(insertBefore != NULL);
if ((splatValue % scale) == 0) { if ((splatValue % scale) == 0) {
// *result = otherOperand + splatOperand / splatValue; // *result = otherOperand * splatOperand / scale;
llvm::Value *splatScaleVec = llvm::Value *splatScaleVec =
(splatOperand->getType() == LLVMTypes::Int32VectorType) ? (splatOperand->getType() == LLVMTypes::Int32VectorType) ?
LLVMInt32Vector(scale) : LLVMInt64Vector(scale); LLVMInt32Vector(scale) : LLVMInt64Vector(scale);
@@ -1452,7 +1452,7 @@ lExtract248Scale(llvm::Value *splatOperand, int splatValue,
splatOperand, splatScaleVec, splatOperand, splatScaleVec,
"div", insertBefore); "div", insertBefore);
*result = *result =
llvm::BinaryOperator::Create(llvm::Instruction::Add, llvm::BinaryOperator::Create(llvm::Instruction::Mul,
splatDiv, otherOperand, splatDiv, otherOperand,
"add", insertBefore); "add", insertBefore);
return LLVMInt32(scale); return LLVMInt32(scale);