I broke negate of FP values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107019
91177308-0d34-0410-b5e6-
96231b3b80d8
TestAndClearIgnoreResultAssign();
// Emit unary minus with EmitSub so we handle overflow cases etc.
BinOpInfo BinOp;
- BinOp.RHS = Visit(E->getSubExpr());;
- BinOp.LHS = llvm::Constant::getNullValue(BinOp.RHS->getType());
+ BinOp.RHS = Visit(E->getSubExpr());
+
+ if (BinOp.RHS->getType()->isFPOrFPVectorTy())
+ BinOp.LHS = llvm::ConstantFP::getZeroValueForNegation(BinOp.RHS->getType());
+ else
+ BinOp.LHS = llvm::Constant::getNullValue(BinOp.RHS->getType());
BinOp.Ty = E->getType();
BinOp.Opcode = BinaryOperator::Sub;
BinOp.E = E;
// CHECK: ret i32 1
return 1||1;
}
+
+// Make sure negate of fp uses -0.0 for proper -0 handling.
+double f13(double X) {
+ // CHECK: define double @f13
+ // CHECK: fsub double -0.000000e+00, %tmp
+ return -X;
+}