diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-12-13 01:57:55 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-12-13 01:57:55 +0000 |
commit | 0a5b805f6d9690325b05f0c6a4a518fb9d0c060c (patch) | |
tree | ec7071f1a33c566ed9bacbcd09fe90cd398641f5 | |
parent | 42be3a3096e30e07c6a595b37739cd09951a265f (diff) | |
download | bcm5719-llvm-0a5b805f6d9690325b05f0c6a4a518fb9d0c060c.tar.gz bcm5719-llvm-0a5b805f6d9690325b05f0c6a4a518fb9d0c060c.zip |
Expand f32 / f64 to i32 / i64 conversion to soft-fp library calls.
llvm-svn: 32523
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 2079259a5fa..695e1970ff9 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -2860,8 +2860,29 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { break; } break; - case Expand: - assert(0 && "Shouldn't need to expand other operators here!"); + case Expand: { + // Convert f32 / f64 to i32 / i64. + MVT::ValueType VT = Op.getValueType(); + const char *FnName = 0; + switch (Node->getOpcode()) { + case ISD::FP_TO_SINT: + if (Node->getOperand(0).getValueType() == MVT::f32) + FnName = (VT == MVT::i32) ? "__fixsfsi" : "__fixsfdi"; + else + FnName = (VT == MVT::i32) ? "__fixdfsi" : "__fixdfdi"; + break; + case ISD::FP_TO_UINT: + if (Node->getOperand(0).getValueType() == MVT::f32) + FnName = (VT == MVT::i32) ? "__fixunssfsi" : "__fixunssfdi"; + else + FnName = (VT == MVT::i32) ? "__fixunsdfsi" : "__fixunsdfdi"; + break; + default: assert(0 && "Unreachable!"); + } + SDOperand Dummy; + Result = ExpandLibCall(FnName, Node, Dummy); + break; + } case Promote: Tmp1 = PromoteOp(Node->getOperand(0)); Result = DAG.UpdateNodeOperands(Result, LegalizeOp(Tmp1)); |