llvm.org GIT mirror llvm / c42e640
Inline implVisitAluOverflow by introducing a nested switch to convert the intrinsic to an nodetype. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154478 91177308-0d34-0410-b5e6-96231b3b80d8 Craig Topper 8 years ago
2 changed file(s) with 19 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
36283628 return DAG.getConstantFP(APFloat(APInt(32, Flt)), MVT::f32);
36293629 }
36303630
3631 // implVisitAluOverflow - Lower arithmetic overflow instrinsics.
3632 const char *
3633 SelectionDAGBuilder::implVisitAluOverflow(const CallInst &I, ISD::NodeType Op) {
3634 SDValue Op1 = getValue(I.getArgOperand(0));
3635 SDValue Op2 = getValue(I.getArgOperand(1));
3636
3637 SDVTList VTs = DAG.getVTList(Op1.getValueType(), MVT::i1);
3638 setValue(&I, DAG.getNode(Op, getCurDebugLoc(), VTs, Op1, Op2));
3639 return 0;
3640 }
3641
36423631 /// visitExp - Lower an exp intrinsic. Handles the special sequences for
36433632 /// limited-precision mode.
36443633 void
48664855 case Intrinsic::convertuu: {
48674856 ISD::CvtCode Code = ISD::CVT_INVALID;
48684857 switch (Intrinsic) {
4858 default: llvm_unreachable("Impossible intrinsic"); // Can't reach here.
48694859 case Intrinsic::convertff: Code = ISD::CVT_FF; break;
48704860 case Intrinsic::convertfsi: Code = ISD::CVT_FS; break;
48714861 case Intrinsic::convertfui: Code = ISD::CVT_FU; break;
50985088 return 0;
50995089 }
51005090 case Intrinsic::uadd_with_overflow:
5101 return implVisitAluOverflow(I, ISD::UADDO);
51025091 case Intrinsic::sadd_with_overflow:
5103 return implVisitAluOverflow(I, ISD::SADDO);
51045092 case Intrinsic::usub_with_overflow:
5105 return implVisitAluOverflow(I, ISD::USUBO);
51065093 case Intrinsic::ssub_with_overflow:
5107 return implVisitAluOverflow(I, ISD::SSUBO);
51085094 case Intrinsic::umul_with_overflow:
5109 return implVisitAluOverflow(I, ISD::UMULO);
5110 case Intrinsic::smul_with_overflow:
5111 return implVisitAluOverflow(I, ISD::SMULO);
5112
5095 case Intrinsic::smul_with_overflow: {
5096 ISD::NodeType Op;
5097 switch (Intrinsic) {
5098 default: llvm_unreachable("Impossible intrinsic"); // Can't reach here.
5099 case Intrinsic::uadd_with_overflow: Op = ISD::UADDO; break;
5100 case Intrinsic::sadd_with_overflow: Op = ISD::SADDO; break;
5101 case Intrinsic::usub_with_overflow: Op = ISD::USUBO; break;
5102 case Intrinsic::ssub_with_overflow: Op = ISD::SSUBO; break;
5103 case Intrinsic::umul_with_overflow: Op = ISD::UMULO; break;
5104 case Intrinsic::smul_with_overflow: Op = ISD::SMULO; break;
5105 }
5106 SDValue Op1 = getValue(I.getArgOperand(0));
5107 SDValue Op2 = getValue(I.getArgOperand(1));
5108
5109 SDVTList VTs = DAG.getVTList(Op1.getValueType(), MVT::i1);
5110 setValue(&I, DAG.getNode(Op, getCurDebugLoc(), VTs, Op1, Op2));
5111 return 0;
5112 }
51135113 case Intrinsic::prefetch: {
51145114 SDValue Ops[5];
51155115 unsigned rw = cast(I.getArgOperand(1))->getZExtValue();
555555 void visitUserOp2(const Instruction &I) {
556556 llvm_unreachable("UserOp2 should not exist at instruction selection time!");
557557 }
558
559 const char *implVisitAluOverflow(const CallInst &I, ISD::NodeType Op);
560558
561559 void HandlePHINodesInSuccessorBlocks(const BasicBlock *LLVMBB);
562560