[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Evan Cheng
evan.cheng at apple.com
Tue Dec 12 18:38:28 PST 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.437 -> 1.438
---
Log message:
Expand fsqrt, fsin, and fcos to libcalls.
---
Diffs of the changes: (+25 -10)
LegalizeDAG.cpp | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.437 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.438
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.437 Tue Dec 12 19:57:55 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Tue Dec 12 20:38:13 2006
@@ -4951,23 +4951,38 @@
case ISD::FP_ROUND:
Lo = ExpandLibCall("__truncdfsf2", Node, Hi);
break;
- case ISD::SINT_TO_FP:
+ case ISD::SINT_TO_FP: {
+ const char *FnName = 0;
if (Node->getOperand(0).getValueType() == MVT::i64)
- Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatdisf" : "__floatdidf"),
- Node, Hi);
+ FnName = (VT == MVT::f32) ? "__floatdisf" : "__floatdidf";
else
- Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatsisf" : "__floatsidf"),
- Node, Hi);
+ FnName = (VT == MVT::f32) ? "__floatsisf" : "__floatsidf";
+ Lo = ExpandLibCall(FnName, Node, Hi);
break;
- case ISD::UINT_TO_FP:
+ }
+ case ISD::UINT_TO_FP: {
+ const char *FnName = 0;
if (Node->getOperand(0).getValueType() == MVT::i64)
- Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatundisf" : "__floatundidf"),
- Node, Hi);
+ FnName = (VT == MVT::f32) ? "__floatundisf" : "__floatundidf";
else
- Lo = ExpandLibCall(((VT == MVT::f32) ? "__floatunsisf" : "__floatunsidf"),
- Node, Hi);
+ FnName = (VT == MVT::f32) ? "__floatunsisf" : "__floatunsidf";
+ Lo = ExpandLibCall(FnName, Node, Hi);
break;
}
+ case ISD::FSQRT:
+ case ISD::FSIN:
+ case ISD::FCOS: {
+ const char *FnName = 0;
+ switch(Node->getOpcode()) {
+ case ISD::FSQRT: FnName = (VT == MVT::f32) ? "sqrtf" : "sqrt"; break;
+ case ISD::FSIN: FnName = (VT == MVT::f32) ? "sinf" : "sin"; break;
+ case ISD::FCOS: FnName = (VT == MVT::f32) ? "cosf" : "cos"; break;
+ default: assert(0 && "Unreachable!");
+ }
+ Lo = ExpandLibCall(FnName, Node, Hi);
+ break;
+ }
+ }
// Make sure the resultant values have been legalized themselves, unless this
// is a type that requires multi-step expansion.
More information about the llvm-commits
mailing list