• Home
  • Raw
  • Download

Lines Matching refs:Builder

35                                           IRBuilder<> &Builder) {  in generateSignedRemainderCode()  argument
40 Shift = Builder.getInt64(63); in generateSignedRemainderCode()
43 Shift = Builder.getInt32(31); in generateSignedRemainderCode()
58 Value *DividendSign = Builder.CreateAShr(Dividend, Shift); in generateSignedRemainderCode()
59 Value *DivisorSign = Builder.CreateAShr(Divisor, Shift); in generateSignedRemainderCode()
60 Value *DvdXor = Builder.CreateXor(Dividend, DividendSign); in generateSignedRemainderCode()
61 Value *DvsXor = Builder.CreateXor(Divisor, DivisorSign); in generateSignedRemainderCode()
62 Value *UDividend = Builder.CreateSub(DvdXor, DividendSign); in generateSignedRemainderCode()
63 Value *UDivisor = Builder.CreateSub(DvsXor, DivisorSign); in generateSignedRemainderCode()
64 Value *URem = Builder.CreateURem(UDividend, UDivisor); in generateSignedRemainderCode()
65 Value *Xored = Builder.CreateXor(URem, DividendSign); in generateSignedRemainderCode()
66 Value *SRem = Builder.CreateSub(Xored, DividendSign); in generateSignedRemainderCode()
69 Builder.SetInsertPoint(URemInst); in generateSignedRemainderCode()
81 IRBuilder<> &Builder) { in generatedUnsignedRemainderCode() argument
89 Value *Quotient = Builder.CreateUDiv(Dividend, Divisor); in generatedUnsignedRemainderCode()
90 Value *Product = Builder.CreateMul(Divisor, Quotient); in generatedUnsignedRemainderCode()
91 Value *Remainder = Builder.CreateSub(Dividend, Product); in generatedUnsignedRemainderCode()
94 Builder.SetInsertPoint(UDiv); in generatedUnsignedRemainderCode()
105 IRBuilder<> &Builder) { in generateSignedDivisionCode() argument
112 Shift = Builder.getInt64(63); in generateSignedDivisionCode()
115 Shift = Builder.getInt32(31); in generateSignedDivisionCode()
131 Value *Tmp = Builder.CreateAShr(Dividend, Shift); in generateSignedDivisionCode()
132 Value *Tmp1 = Builder.CreateAShr(Divisor, Shift); in generateSignedDivisionCode()
133 Value *Tmp2 = Builder.CreateXor(Tmp, Dividend); in generateSignedDivisionCode()
134 Value *U_Dvnd = Builder.CreateSub(Tmp2, Tmp); in generateSignedDivisionCode()
135 Value *Tmp3 = Builder.CreateXor(Tmp1, Divisor); in generateSignedDivisionCode()
136 Value *U_Dvsr = Builder.CreateSub(Tmp3, Tmp1); in generateSignedDivisionCode()
137 Value *Q_Sgn = Builder.CreateXor(Tmp1, Tmp); in generateSignedDivisionCode()
138 Value *Q_Mag = Builder.CreateUDiv(U_Dvnd, U_Dvsr); in generateSignedDivisionCode()
139 Value *Tmp4 = Builder.CreateXor(Q_Mag, Q_Sgn); in generateSignedDivisionCode()
140 Value *Q = Builder.CreateSub(Tmp4, Q_Sgn); in generateSignedDivisionCode()
143 Builder.SetInsertPoint(UDiv); in generateSignedDivisionCode()
152 IRBuilder<> &Builder) { in generateUnsignedDivisionCode() argument
167 Zero = Builder.getInt64(0); in generateUnsignedDivisionCode()
168 One = Builder.getInt64(1); in generateUnsignedDivisionCode()
170 MSB = Builder.getInt64(63); in generateUnsignedDivisionCode()
173 Zero = Builder.getInt32(0); in generateUnsignedDivisionCode()
174 One = Builder.getInt32(1); in generateUnsignedDivisionCode()
176 MSB = Builder.getInt32(31); in generateUnsignedDivisionCode()
179 ConstantInt *True = Builder.getTrue(); in generateUnsignedDivisionCode()
181 BasicBlock *IBB = Builder.GetInsertBlock(); in generateUnsignedDivisionCode()
218 BasicBlock *SpecialCases = Builder.GetInsertBlock(); in generateUnsignedDivisionCode()
220 BasicBlock *End = SpecialCases->splitBasicBlock(Builder.GetInsertPoint(), in generateUnsignedDivisionCode()
222 BasicBlock *LoopExit = BasicBlock::Create(Builder.getContext(), in generateUnsignedDivisionCode()
224 BasicBlock *DoWhile = BasicBlock::Create(Builder.getContext(), in generateUnsignedDivisionCode()
226 BasicBlock *Preheader = BasicBlock::Create(Builder.getContext(), in generateUnsignedDivisionCode()
228 BasicBlock *BB1 = BasicBlock::Create(Builder.getContext(), in generateUnsignedDivisionCode()
251 Builder.SetInsertPoint(SpecialCases); in generateUnsignedDivisionCode()
252 Value *Ret0_1 = Builder.CreateICmpEQ(Divisor, Zero); in generateUnsignedDivisionCode()
253 Value *Ret0_2 = Builder.CreateICmpEQ(Dividend, Zero); in generateUnsignedDivisionCode()
254 Value *Ret0_3 = Builder.CreateOr(Ret0_1, Ret0_2); in generateUnsignedDivisionCode()
255 Value *Tmp0 = Builder.CreateCall(CTLZ, {Divisor, True}); in generateUnsignedDivisionCode()
256 Value *Tmp1 = Builder.CreateCall(CTLZ, {Dividend, True}); in generateUnsignedDivisionCode()
257 Value *SR = Builder.CreateSub(Tmp0, Tmp1); in generateUnsignedDivisionCode()
258 Value *Ret0_4 = Builder.CreateICmpUGT(SR, MSB); in generateUnsignedDivisionCode()
259 Value *Ret0 = Builder.CreateOr(Ret0_3, Ret0_4); in generateUnsignedDivisionCode()
260 Value *RetDividend = Builder.CreateICmpEQ(SR, MSB); in generateUnsignedDivisionCode()
261 Value *RetVal = Builder.CreateSelect(Ret0, Zero, Dividend); in generateUnsignedDivisionCode()
262 Value *EarlyRet = Builder.CreateOr(Ret0, RetDividend); in generateUnsignedDivisionCode()
263 Builder.CreateCondBr(EarlyRet, End, BB1); in generateUnsignedDivisionCode()
271 Builder.SetInsertPoint(BB1); in generateUnsignedDivisionCode()
272 Value *SR_1 = Builder.CreateAdd(SR, One); in generateUnsignedDivisionCode()
273 Value *Tmp2 = Builder.CreateSub(MSB, SR); in generateUnsignedDivisionCode()
274 Value *Q = Builder.CreateShl(Dividend, Tmp2); in generateUnsignedDivisionCode()
275 Value *SkipLoop = Builder.CreateICmpEQ(SR_1, Zero); in generateUnsignedDivisionCode()
276 Builder.CreateCondBr(SkipLoop, LoopExit, Preheader); in generateUnsignedDivisionCode()
282 Builder.SetInsertPoint(Preheader); in generateUnsignedDivisionCode()
283 Value *Tmp3 = Builder.CreateLShr(Dividend, SR_1); in generateUnsignedDivisionCode()
284 Value *Tmp4 = Builder.CreateAdd(Divisor, NegOne); in generateUnsignedDivisionCode()
285 Builder.CreateBr(DoWhile); in generateUnsignedDivisionCode()
305 Builder.SetInsertPoint(DoWhile); in generateUnsignedDivisionCode()
306 PHINode *Carry_1 = Builder.CreatePHI(DivTy, 2); in generateUnsignedDivisionCode()
307 PHINode *SR_3 = Builder.CreatePHI(DivTy, 2); in generateUnsignedDivisionCode()
308 PHINode *R_1 = Builder.CreatePHI(DivTy, 2); in generateUnsignedDivisionCode()
309 PHINode *Q_2 = Builder.CreatePHI(DivTy, 2); in generateUnsignedDivisionCode()
310 Value *Tmp5 = Builder.CreateShl(R_1, One); in generateUnsignedDivisionCode()
311 Value *Tmp6 = Builder.CreateLShr(Q_2, MSB); in generateUnsignedDivisionCode()
312 Value *Tmp7 = Builder.CreateOr(Tmp5, Tmp6); in generateUnsignedDivisionCode()
313 Value *Tmp8 = Builder.CreateShl(Q_2, One); in generateUnsignedDivisionCode()
314 Value *Q_1 = Builder.CreateOr(Carry_1, Tmp8); in generateUnsignedDivisionCode()
315 Value *Tmp9 = Builder.CreateSub(Tmp4, Tmp7); in generateUnsignedDivisionCode()
316 Value *Tmp10 = Builder.CreateAShr(Tmp9, MSB); in generateUnsignedDivisionCode()
317 Value *Carry = Builder.CreateAnd(Tmp10, One); in generateUnsignedDivisionCode()
318 Value *Tmp11 = Builder.CreateAnd(Tmp10, Divisor); in generateUnsignedDivisionCode()
319 Value *R = Builder.CreateSub(Tmp7, Tmp11); in generateUnsignedDivisionCode()
320 Value *SR_2 = Builder.CreateAdd(SR_3, NegOne); in generateUnsignedDivisionCode()
321 Value *Tmp12 = Builder.CreateICmpEQ(SR_2, Zero); in generateUnsignedDivisionCode()
322 Builder.CreateCondBr(Tmp12, LoopExit, DoWhile); in generateUnsignedDivisionCode()
330 Builder.SetInsertPoint(LoopExit); in generateUnsignedDivisionCode()
331 PHINode *Carry_2 = Builder.CreatePHI(DivTy, 2); in generateUnsignedDivisionCode()
332 PHINode *Q_3 = Builder.CreatePHI(DivTy, 2); in generateUnsignedDivisionCode()
333 Value *Tmp13 = Builder.CreateShl(Q_3, One); in generateUnsignedDivisionCode()
334 Value *Q_4 = Builder.CreateOr(Carry_2, Tmp13); in generateUnsignedDivisionCode()
335 Builder.CreateBr(End); in generateUnsignedDivisionCode()
340 Builder.SetInsertPoint(End, End->begin()); in generateUnsignedDivisionCode()
341 PHINode *Q_5 = Builder.CreatePHI(DivTy, 2); in generateUnsignedDivisionCode()
381 IRBuilder<> Builder(Rem); in expandRemainder() local
395 Rem->getOperand(1), Builder); in expandRemainder()
404 if (Rem == Builder.GetInsertPoint().getNodePtrUnchecked()) in expandRemainder()
407 BinaryOperator *BO = dyn_cast<BinaryOperator>(Builder.GetInsertPoint()); in expandRemainder()
413 Builder); in expandRemainder()
420 if (BinaryOperator *UDiv = dyn_cast<BinaryOperator>(Builder.GetInsertPoint())) { in expandRemainder()
441 IRBuilder<> Builder(Div); in expandDivision() local
456 Div->getOperand(1), Builder); in expandDivision()
464 if (Div == Builder.GetInsertPoint().getNodePtrUnchecked()) in expandDivision()
467 BinaryOperator *BO = dyn_cast<BinaryOperator>(Builder.GetInsertPoint()); in expandDivision()
474 Builder); in expandDivision()
508 IRBuilder<> Builder(Rem); in expandRemainderUpTo32Bits() local
514 Type *Int32Ty = Builder.getInt32Ty(); in expandRemainderUpTo32Bits()
517 ExtDividend = Builder.CreateSExt(Rem->getOperand(0), Int32Ty); in expandRemainderUpTo32Bits()
518 ExtDivisor = Builder.CreateSExt(Rem->getOperand(1), Int32Ty); in expandRemainderUpTo32Bits()
519 ExtRem = Builder.CreateSRem(ExtDividend, ExtDivisor); in expandRemainderUpTo32Bits()
521 ExtDividend = Builder.CreateZExt(Rem->getOperand(0), Int32Ty); in expandRemainderUpTo32Bits()
522 ExtDivisor = Builder.CreateZExt(Rem->getOperand(1), Int32Ty); in expandRemainderUpTo32Bits()
523 ExtRem = Builder.CreateURem(ExtDividend, ExtDivisor); in expandRemainderUpTo32Bits()
525 Trunc = Builder.CreateTrunc(ExtRem, RemTy); in expandRemainderUpTo32Bits()
558 IRBuilder<> Builder(Rem); in expandRemainderUpTo64Bits() local
564 Type *Int64Ty = Builder.getInt64Ty(); in expandRemainderUpTo64Bits()
567 ExtDividend = Builder.CreateSExt(Rem->getOperand(0), Int64Ty); in expandRemainderUpTo64Bits()
568 ExtDivisor = Builder.CreateSExt(Rem->getOperand(1), Int64Ty); in expandRemainderUpTo64Bits()
569 ExtRem = Builder.CreateSRem(ExtDividend, ExtDivisor); in expandRemainderUpTo64Bits()
571 ExtDividend = Builder.CreateZExt(Rem->getOperand(0), Int64Ty); in expandRemainderUpTo64Bits()
572 ExtDivisor = Builder.CreateZExt(Rem->getOperand(1), Int64Ty); in expandRemainderUpTo64Bits()
573 ExtRem = Builder.CreateURem(ExtDividend, ExtDivisor); in expandRemainderUpTo64Bits()
575 Trunc = Builder.CreateTrunc(ExtRem, RemTy); in expandRemainderUpTo64Bits()
609 IRBuilder<> Builder(Div); in expandDivisionUpTo32Bits() local
615 Type *Int32Ty = Builder.getInt32Ty(); in expandDivisionUpTo32Bits()
618 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int32Ty); in expandDivisionUpTo32Bits()
619 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int32Ty); in expandDivisionUpTo32Bits()
620 ExtDiv = Builder.CreateSDiv(ExtDividend, ExtDivisor); in expandDivisionUpTo32Bits()
622 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int32Ty); in expandDivisionUpTo32Bits()
623 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int32Ty); in expandDivisionUpTo32Bits()
624 ExtDiv = Builder.CreateUDiv(ExtDividend, ExtDivisor); in expandDivisionUpTo32Bits()
626 Trunc = Builder.CreateTrunc(ExtDiv, DivTy); in expandDivisionUpTo32Bits()
659 IRBuilder<> Builder(Div); in expandDivisionUpTo64Bits() local
665 Type *Int64Ty = Builder.getInt64Ty(); in expandDivisionUpTo64Bits()
668 ExtDividend = Builder.CreateSExt(Div->getOperand(0), Int64Ty); in expandDivisionUpTo64Bits()
669 ExtDivisor = Builder.CreateSExt(Div->getOperand(1), Int64Ty); in expandDivisionUpTo64Bits()
670 ExtDiv = Builder.CreateSDiv(ExtDividend, ExtDivisor); in expandDivisionUpTo64Bits()
672 ExtDividend = Builder.CreateZExt(Div->getOperand(0), Int64Ty); in expandDivisionUpTo64Bits()
673 ExtDivisor = Builder.CreateZExt(Div->getOperand(1), Int64Ty); in expandDivisionUpTo64Bits()
674 ExtDiv = Builder.CreateUDiv(ExtDividend, ExtDivisor); in expandDivisionUpTo64Bits()
676 Trunc = Builder.CreateTrunc(ExtDiv, DivTy); in expandDivisionUpTo64Bits()