Handle -0.0 correctly

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12530 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-03-29 19:51:24 +00:00
parent c50bbc9613
commit d25e3ecb3c

View File

@ -313,7 +313,10 @@ ConstantExpr::ConstantExpr(Constant *C, const std::vector<Constant*> &IdxList,
/// specify the full Instruction::OPCODE identifier.
///
Constant *ConstantExpr::getNeg(Constant *C) {
return get(Instruction::Sub, getNullValue(C->getType()), C);
if (!C->getType()->isFloatingPoint())
return get(Instruction::Sub, getNullValue(C->getType()), C);
else
return get(Instruction::Sub, ConstantFP::get(C->getType(), -0.0), C);
}
Constant *ConstantExpr::getNot(Constant *C) {
assert(isa<ConstantIntegral>(C) && "Cannot NOT a nonintegral type!");