mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
use ConstantVector::getSplat in a few places.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148929 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1873,46 +1873,27 @@ BinaryOperator *BinaryOperator::CreateNUWNeg(Value *Op, const Twine &Name,
|
||||
BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name,
|
||||
Instruction *InsertBefore) {
|
||||
Value *zero = ConstantFP::getZeroValueForNegation(Op->getType());
|
||||
return new BinaryOperator(Instruction::FSub,
|
||||
zero, Op,
|
||||
return new BinaryOperator(Instruction::FSub, zero, Op,
|
||||
Op->getType(), Name, InsertBefore);
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::CreateFNeg(Value *Op, const Twine &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
Value *zero = ConstantFP::getZeroValueForNegation(Op->getType());
|
||||
return new BinaryOperator(Instruction::FSub,
|
||||
zero, Op,
|
||||
return new BinaryOperator(Instruction::FSub, zero, Op,
|
||||
Op->getType(), Name, InsertAtEnd);
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
|
||||
Instruction *InsertBefore) {
|
||||
Constant *C;
|
||||
if (VectorType *PTy = dyn_cast<VectorType>(Op->getType())) {
|
||||
C = Constant::getAllOnesValue(PTy->getElementType());
|
||||
C = ConstantVector::get(
|
||||
std::vector<Constant*>(PTy->getNumElements(), C));
|
||||
} else {
|
||||
C = Constant::getAllOnesValue(Op->getType());
|
||||
}
|
||||
|
||||
Constant *C = Constant::getAllOnesValue(Op->getType());
|
||||
return new BinaryOperator(Instruction::Xor, Op, C,
|
||||
Op->getType(), Name, InsertBefore);
|
||||
}
|
||||
|
||||
BinaryOperator *BinaryOperator::CreateNot(Value *Op, const Twine &Name,
|
||||
BasicBlock *InsertAtEnd) {
|
||||
Constant *AllOnes;
|
||||
if (VectorType *PTy = dyn_cast<VectorType>(Op->getType())) {
|
||||
// Create a vector of all ones values.
|
||||
Constant *Elt = Constant::getAllOnesValue(PTy->getElementType());
|
||||
AllOnes = ConstantVector::get(
|
||||
std::vector<Constant*>(PTy->getNumElements(), Elt));
|
||||
} else {
|
||||
AllOnes = Constant::getAllOnesValue(Op->getType());
|
||||
}
|
||||
|
||||
Constant *AllOnes = Constant::getAllOnesValue(Op->getType());
|
||||
return new BinaryOperator(Instruction::Xor, Op, AllOnes,
|
||||
Op->getType(), Name, InsertAtEnd);
|
||||
}
|
||||
|
Reference in New Issue
Block a user