[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Evan Cheng
evan.cheng at apple.com
Fri Dec 15 16:52:55 PST 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.444 -> 1.445
---
Log message:
Expand fabs / fneg to and / xor.
---
Diffs of the changes: (+22 -3)
LegalizeDAG.cpp | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.444 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.445
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.444 Fri Dec 15 16:42:55 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Dec 15 18:52:40 2006
@@ -5055,9 +5055,6 @@
case ISD::SREM: Lo = ExpandLibCall("__moddi3" , Node, Hi); break;
case ISD::UREM: Lo = ExpandLibCall("__umoddi3", Node, Hi); break;
- case ISD::FNEG:
- Lo = ExpandLibCall(((VT == MVT::f32) ? "__negsf2" : "__negdf2"), Node, Hi);
- break;
case ISD::FADD:
Lo = ExpandLibCall(((VT == MVT::f32) ? "__addsf3" : "__adddf3"), Node, Hi);
break;
@@ -5107,6 +5104,28 @@
Lo = ExpandLibCall(FnName, Node, Hi);
break;
}
+ case ISD::FABS: {
+ SDOperand Mask = (VT == MVT::f64)
+ ? DAG.getConstantFP(BitsToDouble(~(1ULL << 63)), VT)
+ : DAG.getConstantFP(BitsToFloat(~(1U << 31)), VT);
+ Mask = DAG.getNode(ISD::BIT_CONVERT, NVT, Mask);
+ Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0));
+ Lo = DAG.getNode(ISD::AND, NVT, Lo, Mask);
+ if (getTypeAction(NVT) == Expand)
+ ExpandOp(Lo, Lo, Hi);
+ break;
+ }
+ case ISD::FNEG: {
+ SDOperand Mask = (VT == MVT::f64)
+ ? DAG.getConstantFP(BitsToDouble(1ULL << 63), VT)
+ : DAG.getConstantFP(BitsToFloat(1U << 31), VT);
+ Mask = DAG.getNode(ISD::BIT_CONVERT, NVT, Mask);
+ Lo = DAG.getNode(ISD::BIT_CONVERT, NVT, Node->getOperand(0));
+ Lo = DAG.getNode(ISD::XOR, NVT, Lo, Mask);
+ if (getTypeAction(NVT) == Expand)
+ ExpandOp(Lo, Lo, Hi);
+ break;
+ }
}
// Make sure the resultant values have been legalized themselves, unless this
More information about the llvm-commits
mailing list