diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-11-30 16:10:29 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-11-30 16:10:29 +0000 |
commit | 873ed82a36c91ca012c0ec42ba4ac8389e2fb9ea (patch) | |
tree | e80bca8344bfbd92e8d0e7b1a49ad48012be490c /llvm/lib/Target/Alpha/AlphaISelLowering.cpp | |
parent | 1064d6ec43957fb7c94ce75348d9b974832dc241 (diff) | |
download | bcm5719-llvm-873ed82a36c91ca012c0ec42ba4ac8389e2fb9ea.tar.gz bcm5719-llvm-873ed82a36c91ca012c0ec42ba4ac8389e2fb9ea.zip |
FPSelect and more custom lowering
llvm-svn: 24535
Diffstat (limited to 'llvm/lib/Target/Alpha/AlphaISelLowering.cpp')
-rw-r--r-- | llvm/lib/Target/Alpha/AlphaISelLowering.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/llvm/lib/Target/Alpha/AlphaISelLowering.cpp b/llvm/lib/Target/Alpha/AlphaISelLowering.cpp index 92ba16e21bf..3ebb046ff9f 100644 --- a/llvm/lib/Target/Alpha/AlphaISelLowering.cpp +++ b/llvm/lib/Target/Alpha/AlphaISelLowering.cpp @@ -73,7 +73,9 @@ AlphaTargetLowering::AlphaTargetLowering(TargetMachine &TM) : TargetLowering(TM) setOperationAction(ISD::UINT_TO_FP, MVT::i64, Expand); setOperationAction(ISD::SINT_TO_FP, MVT::i64, Custom); - + setOperationAction(ISD::FP_TO_UINT, MVT::i64, Expand); + setOperationAction(ISD::FP_TO_SINT, MVT::i64, Custom); + if (!TM.getSubtarget<AlphaSubtarget>().hasCT()) { setOperationAction(ISD::CTPOP , MVT::i64 , Expand); setOperationAction(ISD::CTTZ , MVT::i64 , Expand); @@ -412,7 +414,28 @@ SDOperand AlphaTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { isDouble?MVT::f64:MVT::f32, LD); return FP; } + case ISD::FP_TO_SINT: { + bool isDouble = MVT::f64 == Op.getOperand(0).getValueType(); + SDOperand src = Op.getOperand(0); + + if (!isDouble) //Promote + src = DAG.getNode(ISD::FP_EXTEND, MVT::f64, src); + + src = DAG.getNode(AlphaISD::CVTTQ_, MVT::f64, src); + + if (useITOF) { + return DAG.getNode(AlphaISD::FTOIT_, MVT::i64, src); + } else { + int FrameIdx = + DAG.getMachineFunction().getFrameInfo()->CreateStackObject(8, 8); + SDOperand FI = DAG.getFrameIndex(FrameIdx, MVT::i64); + SDOperand ST = DAG.getNode(ISD::STORE, MVT::Other, DAG.getEntryNode(), + src, FI, DAG.getSrcValue(0)); + return DAG.getLoad(MVT::i64, ST, FI, DAG.getSrcValue(0)); + } } + + } + return SDOperand(); } - |