mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-14 23:48:56 +00:00
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:
parent
f3f475efee
commit
6d9b69fd5f
@ -1358,31 +1358,39 @@ void CWriter::visitBinaryOperator(Instruction &I) {
|
||||
printType(Out, I.getType());
|
||||
Out << ")(";
|
||||
}
|
||||
|
||||
writeOperand(I.getOperand(0));
|
||||
|
||||
switch (I.getOpcode()) {
|
||||
case Instruction::Add: Out << " + "; break;
|
||||
case Instruction::Sub: Out << " - "; break;
|
||||
case Instruction::Mul: Out << '*'; break;
|
||||
case Instruction::Div: Out << '/'; break;
|
||||
case Instruction::Rem: Out << '%'; break;
|
||||
case Instruction::And: Out << " & "; break;
|
||||
case Instruction::Or: Out << " | "; break;
|
||||
case Instruction::Xor: Out << " ^ "; break;
|
||||
case Instruction::SetEQ: Out << " == "; break;
|
||||
case Instruction::SetNE: Out << " != "; break;
|
||||
case Instruction::SetLE: Out << " <= "; break;
|
||||
case Instruction::SetGE: Out << " >= "; break;
|
||||
case Instruction::SetLT: Out << " < "; break;
|
||||
case Instruction::SetGT: Out << " > "; break;
|
||||
case Instruction::Shl : Out << " << "; break;
|
||||
case Instruction::Shr : Out << " >> "; break;
|
||||
default: std::cerr << "Invalid operator type!" << I; abort();
|
||||
// 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));
|
||||
|
||||
switch (I.getOpcode()) {
|
||||
case Instruction::Add: Out << " + "; break;
|
||||
case Instruction::Sub: Out << " - "; break;
|
||||
case Instruction::Mul: Out << '*'; break;
|
||||
case Instruction::Div: Out << '/'; break;
|
||||
case Instruction::Rem: Out << '%'; break;
|
||||
case Instruction::And: Out << " & "; break;
|
||||
case Instruction::Or: Out << " | "; break;
|
||||
case Instruction::Xor: Out << " ^ "; break;
|
||||
case Instruction::SetEQ: Out << " == "; break;
|
||||
case Instruction::SetNE: Out << " != "; break;
|
||||
case Instruction::SetLE: Out << " <= "; break;
|
||||
case Instruction::SetGE: Out << " >= "; break;
|
||||
case Instruction::SetLT: Out << " < "; break;
|
||||
case Instruction::SetGT: Out << " > "; break;
|
||||
case Instruction::Shl : Out << " << "; break;
|
||||
case Instruction::Shr : Out << " >> "; break;
|
||||
default: std::cerr << "Invalid operator type!" << I; abort();
|
||||
}
|
||||
|
||||
writeOperand(I.getOperand(1));
|
||||
}
|
||||
|
||||
writeOperand(I.getOperand(1));
|
||||
|
||||
if (needsCast) {
|
||||
Out << "))";
|
||||
}
|
||||
|
@ -1358,31 +1358,39 @@ void CWriter::visitBinaryOperator(Instruction &I) {
|
||||
printType(Out, I.getType());
|
||||
Out << ")(";
|
||||
}
|
||||
|
||||
writeOperand(I.getOperand(0));
|
||||
|
||||
switch (I.getOpcode()) {
|
||||
case Instruction::Add: Out << " + "; break;
|
||||
case Instruction::Sub: Out << " - "; break;
|
||||
case Instruction::Mul: Out << '*'; break;
|
||||
case Instruction::Div: Out << '/'; break;
|
||||
case Instruction::Rem: Out << '%'; break;
|
||||
case Instruction::And: Out << " & "; break;
|
||||
case Instruction::Or: Out << " | "; break;
|
||||
case Instruction::Xor: Out << " ^ "; break;
|
||||
case Instruction::SetEQ: Out << " == "; break;
|
||||
case Instruction::SetNE: Out << " != "; break;
|
||||
case Instruction::SetLE: Out << " <= "; break;
|
||||
case Instruction::SetGE: Out << " >= "; break;
|
||||
case Instruction::SetLT: Out << " < "; break;
|
||||
case Instruction::SetGT: Out << " > "; break;
|
||||
case Instruction::Shl : Out << " << "; break;
|
||||
case Instruction::Shr : Out << " >> "; break;
|
||||
default: std::cerr << "Invalid operator type!" << I; abort();
|
||||
// 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));
|
||||
|
||||
switch (I.getOpcode()) {
|
||||
case Instruction::Add: Out << " + "; break;
|
||||
case Instruction::Sub: Out << " - "; break;
|
||||
case Instruction::Mul: Out << '*'; break;
|
||||
case Instruction::Div: Out << '/'; break;
|
||||
case Instruction::Rem: Out << '%'; break;
|
||||
case Instruction::And: Out << " & "; break;
|
||||
case Instruction::Or: Out << " | "; break;
|
||||
case Instruction::Xor: Out << " ^ "; break;
|
||||
case Instruction::SetEQ: Out << " == "; break;
|
||||
case Instruction::SetNE: Out << " != "; break;
|
||||
case Instruction::SetLE: Out << " <= "; break;
|
||||
case Instruction::SetGE: Out << " >= "; break;
|
||||
case Instruction::SetLT: Out << " < "; break;
|
||||
case Instruction::SetGT: Out << " > "; break;
|
||||
case Instruction::Shl : Out << " << "; break;
|
||||
case Instruction::Shr : Out << " >> "; break;
|
||||
default: std::cerr << "Invalid operator type!" << I; abort();
|
||||
}
|
||||
|
||||
writeOperand(I.getOperand(1));
|
||||
}
|
||||
|
||||
writeOperand(I.getOperand(1));
|
||||
|
||||
if (needsCast) {
|
||||
Out << "))";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user