[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Evan Cheng
evan.cheng at apple.com
Mon Dec 18 17:44:19 PST 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.448 -> 1.449
---
Log message:
May need to promote the operand (either sign_extend_inreg or and) before
expanding a {s|u}int_to_fp.
---
Diffs of the changes: (+29 -18)
LegalizeDAG.cpp | 47 +++++++++++++++++++++++++++++------------------
1 files changed, 29 insertions(+), 18 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.448 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.449
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.448 Mon Dec 18 16:55:34 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Dec 18 19:44:04 2006
@@ -5072,24 +5072,6 @@
case ISD::FP_ROUND:
Lo = ExpandLibCall("__truncdfsf2", Node, Hi);
break;
- case ISD::SINT_TO_FP: {
- const char *FnName = 0;
- if (Node->getOperand(0).getValueType() == MVT::i64)
- FnName = (VT == MVT::f32) ? "__floatdisf" : "__floatdidf";
- else
- FnName = (VT == MVT::f32) ? "__floatsisf" : "__floatsidf";
- Lo = ExpandLibCall(FnName, Node, Hi);
- break;
- }
- case ISD::UINT_TO_FP: {
- const char *FnName = 0;
- if (Node->getOperand(0).getValueType() == MVT::i64)
- FnName = (VT == MVT::f32) ? "__floatundisf" : "__floatundidf";
- else
- FnName = (VT == MVT::f32) ? "__floatunsisf" : "__floatunsidf";
- Lo = ExpandLibCall(FnName, Node, Hi);
- break;
- }
case ISD::FSQRT:
case ISD::FSIN:
case ISD::FCOS: {
@@ -5125,6 +5107,35 @@
ExpandOp(Lo, Lo, Hi);
break;
}
+ case ISD::SINT_TO_FP:
+ case ISD::UINT_TO_FP: {
+ bool isSigned = Node->getOpcode() == ISD::SINT_TO_FP;
+ MVT::ValueType SrcVT = Node->getOperand(0).getValueType();
+ const char *FnName = 0;
+ if (Node->getOperand(0).getValueType() == MVT::i64) {
+ if (VT == MVT::f32)
+ FnName = isSigned ? "__floatdisf" : "__floatundisf";
+ else
+ FnName = isSigned ? "__floatdidf" : "__floatundidf";
+ } else {
+ if (VT == MVT::f32)
+ FnName = isSigned ? "__floatsisf" : "__floatunsisf";
+ else
+ FnName = isSigned ? "__floatsidf" : "__floatunsidf";
+ }
+
+ // Promote the operand if needed.
+ if (getTypeAction(SrcVT) == Promote) {
+ SDOperand Tmp = PromoteOp(Node->getOperand(0));
+ Tmp = isSigned
+ ? DAG.getNode(ISD::SIGN_EXTEND_INREG, Tmp.getValueType(), Tmp,
+ DAG.getValueType(SrcVT))
+ : DAG.getZeroExtendInReg(Tmp, SrcVT);
+ Node = DAG.UpdateNodeOperands(Op, Tmp).Val;
+ }
+ Lo = ExpandLibCall(FnName, Node, Hi);
+ break;
+ }
}
// Make sure the resultant values have been legalized themselves, unless this
More information about the llvm-commits
mailing list