mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Floating point negates are -0.0 - X, not 0.0 - X
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0517e72096
commit
84a102a780
@ -78,9 +78,14 @@ BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2,
|
|||||||
|
|
||||||
BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
|
BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
|
||||||
Instruction *InsertBefore) {
|
Instruction *InsertBefore) {
|
||||||
|
if (!Op->getType()->isFloatingPoint())
|
||||||
return new BinaryOperator(Instruction::Sub,
|
return new BinaryOperator(Instruction::Sub,
|
||||||
Constant::getNullValue(Op->getType()), Op,
|
Constant::getNullValue(Op->getType()), Op,
|
||||||
Op->getType(), Name, InsertBefore);
|
Op->getType(), Name, InsertBefore);
|
||||||
|
else
|
||||||
|
return new BinaryOperator(Instruction::Sub,
|
||||||
|
ConstantFP::get(Op->getType(), -0.0), Op,
|
||||||
|
Op->getType(), Name, InsertBefore);
|
||||||
}
|
}
|
||||||
|
|
||||||
BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
|
BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
|
||||||
@ -98,8 +103,11 @@ static inline bool isConstantAllOnes(const Value *V) {
|
|||||||
|
|
||||||
bool BinaryOperator::isNeg(const Value *V) {
|
bool BinaryOperator::isNeg(const Value *V) {
|
||||||
if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(V))
|
if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(V))
|
||||||
return Bop->getOpcode() == Instruction::Sub &&
|
if (Bop->getOpcode() == Instruction::Sub)
|
||||||
Bop->getOperand(0) == Constant::getNullValue(Bop->getType());
|
if (!V->getType()->isFloatingPoint())
|
||||||
|
return Bop->getOperand(0) == Constant::getNullValue(Bop->getType());
|
||||||
|
else
|
||||||
|
return Bop->getOperand(0) == ConstantFP::get(Bop->getType(), -0.0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user