Lines Matching full:dividend
29 /// remainder, which will have the sign of the dividend. Builder's insert point
34 static Value *generateSignedRemainderCode(Value *Dividend, Value *Divisor,
36 unsigned BitWidth = Dividend->getType()->getIntegerBitWidth();
49 // ; %dividend_sgn = ashr i32 %dividend, 31
51 // ; %dvd_xor = xor i32 %dividend, %dividend_sgn
55 // ; %urem = urem i32 %dividend, %divisor
58 Value *DividendSign = Builder.CreateAShr(Dividend, Shift);
60 Value *DvdXor = Builder.CreateXor(Dividend, DividendSign);
80 static Value *generatedUnsignedRemainderCode(Value *Dividend, Value *Divisor,
82 // Remainder = Dividend - Quotient*Divisor
86 // ; %quotient = udiv i32 %dividend, %divisor
88 // ; %remainder = sub i32 %dividend, %product
89 Value *Quotient = Builder.CreateUDiv(Dividend, Divisor);
91 Value *Remainder = Builder.CreateSub(Dividend, Product);
104 static Value *generateSignedDivisionCode(Value *Dividend, Value *Divisor,
108 unsigned BitWidth = Dividend->getType()->getIntegerBitWidth();
121 // ; %tmp = ashr i32 %dividend, 31
123 // ; %tmp2 = xor i32 %tmp, %dividend
131 Value *Tmp = Builder.CreateAShr(Dividend, Shift);
133 Value *Tmp2 = Builder.CreateXor(Tmp, Dividend);
151 static Value *generateUnsignedDivisionCode(Value *Dividend, Value *Divisor,
158 IntegerType *DivTy = cast<IntegerType>(Dividend->getType());
236 // First off, check for special cases: dividend or divisor is zero, divisor
237 // is greater than dividend, and divisor is 1.
240 // ; %ret0_2 = icmp eq i32 %dividend, 0
243 // ; %tmp1 = tail call i32 @llvm.ctlz.i32(i32 %dividend, i1 true)
248 // ; %retVal = select i1 %ret0, i32 0, i32 %dividend
253 Value *Ret0_2 = Builder.CreateICmpEQ(Dividend, Zero);
256 Value *Tmp1 = Builder.CreateCall(CTLZ, {Dividend, True});
261 Value *RetVal = Builder.CreateSelect(Ret0, Zero, Dividend);
268 // ; %q = shl i32 %dividend, %tmp2
274 Value *Q = Builder.CreateShl(Dividend, Tmp2);
279 // ; %tmp3 = lshr i32 %dividend, %sr_1
283 Value *Tmp3 = Builder.CreateLShr(Dividend, SR_1);