Print -X like this:

double test(double l1_X) {
  return (-l1_X);
}

instead of like this:

double test(double l1_X) {
  return (-0x0p+0 - l1_X);
}


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20423 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2005-03-03 21:12:04 +00:00
parent f3f475efee
commit 6d9b69fd5f
2 changed files with 60 additions and 44 deletions

View File

@@ -1359,6 +1359,13 @@ void CWriter::visitBinaryOperator(Instruction &I) {
Out << ")("; Out << ")(";
} }
// 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)) {
Out << "-";
writeOperand(BinaryOperator::getNegArgument(cast<BinaryOperator>(&I)));
} else {
writeOperand(I.getOperand(0)); writeOperand(I.getOperand(0));
switch (I.getOpcode()) { switch (I.getOpcode()) {
@@ -1382,6 +1389,7 @@ void CWriter::visitBinaryOperator(Instruction &I) {
} }
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
}
if (needsCast) { if (needsCast) {
Out << "))"; Out << "))";

View File

@@ -1359,6 +1359,13 @@ void CWriter::visitBinaryOperator(Instruction &I) {
Out << ")("; Out << ")(";
} }
// 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)) {
Out << "-";
writeOperand(BinaryOperator::getNegArgument(cast<BinaryOperator>(&I)));
} else {
writeOperand(I.getOperand(0)); writeOperand(I.getOperand(0));
switch (I.getOpcode()) { switch (I.getOpcode()) {
@@ -1382,6 +1389,7 @@ void CWriter::visitBinaryOperator(Instruction &I) {
} }
writeOperand(I.getOperand(1)); writeOperand(I.getOperand(1));
}
if (needsCast) { if (needsCast) {
Out << "))"; Out << "))";