Handle -0.0 correctly

llvm-svn: 12530
This commit is contained in:
Chris Lattner 2004-03-29 19:51:24 +00:00
parent 8b1b8ab325
commit 50dc89f874

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!");