mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 23:48:49 +00:00
Turn -0.0 - X -> fneg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
43fdea070c
commit
b9fccc4193
@ -314,7 +314,7 @@ public:
|
||||
//
|
||||
void visitBinary(User &I, unsigned Opcode);
|
||||
void visitAdd(User &I) { visitBinary(I, ISD::ADD); }
|
||||
void visitSub(User &I) { visitBinary(I, ISD::SUB); }
|
||||
void visitSub(User &I);
|
||||
void visitMul(User &I) { visitBinary(I, ISD::MUL); }
|
||||
void visitDiv(User &I) {
|
||||
visitBinary(I, I.getType()->isUnsigned() ? ISD::UDIV : ISD::SDIV);
|
||||
@ -454,6 +454,18 @@ void SelectionDAGLowering::visitBr(BranchInst &I) {
|
||||
}
|
||||
}
|
||||
|
||||
void SelectionDAGLowering::visitSub(User &I) {
|
||||
// -0.0 - X --> fneg
|
||||
if (ConstantFP *CFP = dyn_cast<ConstantFP>(I.getOperand(0)))
|
||||
if (CFP->isExactlyValue(-0.0)) {
|
||||
SDOperand Op2 = getValue(I.getOperand(1));
|
||||
setValue(&I, DAG.getNode(ISD::FNEG, Op2.getValueType(), Op2));
|
||||
return;
|
||||
}
|
||||
|
||||
visitBinary(I, ISD::SUB);
|
||||
}
|
||||
|
||||
void SelectionDAGLowering::visitBinary(User &I, unsigned Opcode) {
|
||||
SDOperand Op1 = getValue(I.getOperand(0));
|
||||
SDOperand Op2 = getValue(I.getOperand(1));
|
||||
|
Loading…
Reference in New Issue
Block a user