aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Target/CBackend/CBackend.cpp2
-rw-r--r--test/CodeGen/CBackend/fneg.ll7
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index ed3ff8171f..5814d2750e 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -2600,7 +2600,7 @@ void CWriter::visitBinaryOperator(Instruction &I) {
// If this is a negation operation, print it out as such. For FP, we don't
// want to print "-0.0 - X".
- if (BinaryOperator::isNeg(&I) || BinaryOperator::isFNeg(&I)) {
+ if (BinaryOperator::isNeg(&I)) {
Out << "-(";
writeOperand(BinaryOperator::getNegArgument(cast<BinaryOperator>(&I)));
Out << ")";
diff --git a/test/CodeGen/CBackend/fneg.ll b/test/CodeGen/CBackend/fneg.ll
new file mode 100644
index 0000000000..68849b20c7
--- /dev/null
+++ b/test/CodeGen/CBackend/fneg.ll
@@ -0,0 +1,7 @@
+; RUN: llvm-as < %s | llc -march=c
+
+define void @func() nounwind {
+ entry:
+ %0 = fsub double -0.0, undef
+ ret void
+}