Teach BinaryOperator::createNot to work with packed integer types

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27124 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2006-03-25 21:54:21 +00:00
parent 0a868961d6
commit fdbc82a925

View File

@ -923,8 +923,15 @@ BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
Instruction *InsertBefore) {
return new BinaryOperator(Instruction::Xor, Op,
ConstantIntegral::getAllOnesValue(Op->getType()),
Constant *C;
if (const PackedType *PTy = dyn_cast<PackedType>(Op->getType())) {
C = ConstantIntegral::getAllOnesValue(PTy->getElementType());
C = ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), C));
} else {
C = ConstantIntegral::getAllOnesValue(Op->getType());
}
return new BinaryOperator(Instruction::Xor, Op, C,
Op->getType(), Name, InsertBefore);
}