#
6a1d0202 |
| 15-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Simplify a for loop initialization based on the fact that 'n' is known to be 1 by an earlier 'if'.
llvm-svn: 303120
|
#
2c9a7066 |
| 13-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Use Lo_32/Hi_32/Make_64 in a few more places in the divide code. NFCI
llvm-svn: 302983
|
#
4b83b4d5 |
| 13-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Fix typo in comment. NFC
llvm-svn: 302974
|
#
b1a71cac |
| 12-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Add early outs for a division by 1 to udiv/urem/udivrem
We already counted the number of bits in the RHS so its pretty cheap to just check if the RHS is 1.
Differential Revision: https://re
[APInt] Add early outs for a division by 1 to udiv/urem/udivrem
We already counted the number of bits in the RHS so its pretty cheap to just check if the RHS is 1.
Differential Revision: https://reviews.llvm.org/D33154
llvm-svn: 302953
show more ...
|
#
2579c7c6 |
| 12-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] In udivrem, remember the bit width in a local variable so we don't reread it from the LHS which might be aliased with Quotient or Remainder.
This helped the compiler generate better code for
[APInt] In udivrem, remember the bit width in a local variable so we don't reread it from the LHS which might be aliased with Quotient or Remainder.
This helped the compiler generate better code for the single word case. It was able to remember that the bit width was still a single word when it created the Remainder APInt and not create code for it possibly being multiword.
llvm-svn: 302952
show more ...
|
#
4bdd621e |
| 12-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Add an assert to check for divide by zero in udivrem. NFC
udiv and urem already had the same assert.
llvm-svn: 302931
|
#
06da0816 |
| 12-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Remove unnecessary checks of rhsWords==1 with lhsWords==1 from udiv and udivrem. NFC
At this point in the code rhsWords is guaranteed to be non-zero and less than or equal to lhsWords. So if
[APInt] Remove unnecessary checks of rhsWords==1 with lhsWords==1 from udiv and udivrem. NFC
At this point in the code rhsWords is guaranteed to be non-zero and less than or equal to lhsWords. So if lhsWords is 1, rhsWords must also be 1. urem alread had the check removed so this makes all 3 consistent.
llvm-svn: 302930
show more ...
|
#
8769403d |
| 12-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Fix a case where udivrem might delete and create a new allocation instead of reusing the original.
llvm-svn: 302882
|
#
a92fd0be |
| 12-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Add a utility method to change the bit width and storage size of an APInt.
Summary: This adds a resize method to APInt that manages deleting/allocating storage for an APInt and changes its b
[APInt] Add a utility method to change the bit width and storage size of an APInt.
Summary: This adds a resize method to APInt that manages deleting/allocating storage for an APInt and changes its bit width. Use this to simplify code in copy assignment and divide.
The assignment code in particular was overly complicated. Treating every possible case as a separate implementation. I'm also pretty sure the clearUnusedBits code at the end was unnecessary. Since we always copying whole words from the source APInt. All unused bits should be clear in the source.
Reviewers: hans, RKSimon
Reviewed By: RKSimon
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D33073
llvm-svn: 302863
show more ...
|
#
dbd6219f |
| 11-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Remove an APInt copy from the return of APInt::multiplicativeInverse.
llvm-svn: 302816
|
#
3fbecada |
| 11-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Fix typo in comment. NFC
llvm-svn: 302815
|
#
c59ced36 |
| 11-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Remove an unneeded extra temporary APInt from toString.
Turns out udivrem can write its output to the same location as one of its inputs so the extra temporary isn't needed.
llvm-svn: 302772
|
#
b3c1f567 |
| 11-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Use negate() instead of copying an APInt to negate it and then writing back over the original value.
llvm-svn: 302770
|
#
ef0114c4 |
| 10-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Add negate helper method to implement twos complement. Use it to shorten code.
llvm-svn: 302716
|
#
ecb97da1 |
| 10-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Make toString use udivrem instead of calling the divide helper method directly. Do a better job of reusing allocations while looping. NFCI
This lets toString take advantage of the degenerate
[APInt] Make toString use udivrem instead of calling the divide helper method directly. Do a better job of reusing allocations while looping. NFCI
This lets toString take advantage of the degenerate case checks in udivrem and is just generally cleaner.
One minor downside of this is that the divisor APInt now needs to be the same size as Tmp which requires an additional allocation. But we were doing a poor job of reusing allocations before so the new code should still be an improvement.
llvm-svn: 302704
show more ...
|
#
6271bc71 |
| 10-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Use uint32_t instead of unsigned for the storage type throughout the divide code. Use Lo_32/Hi_32/Make_64 helpers instead of casts and shifts. NFCI
llvm-svn: 302703
|
#
f86b9d50 |
| 10-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Use getRawData to slightly simplify some code.
llvm-svn: 302702
|
#
93eabae4 |
| 10-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Remove check for single word since single word was handled earlier in the function. NFC
llvm-svn: 302701
|
#
a584af5c |
| 10-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Fix indentation of tcDivide. Combine variable declaration and initialization.
llvm-svn: 302626
|
#
62de039b |
| 10-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Use getNumWords function in udiv/urem/udivrem instead of reimplementinging it.
llvm-svn: 302625
|
#
0acb6654 |
| 09-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Remove return value from tcFullMultiply.
The description says it returns the number of words needed to represent the results. But the way it was coded it always returns (lhsWords + rhsWords)
[APInt] Remove return value from tcFullMultiply.
The description says it returns the number of words needed to represent the results. But the way it was coded it always returns (lhsWords + rhsWords) or (lhsWords + rhsWords - 1). But the result could be even smaller than that and it wouldn't tell you.
No one uses the result today so rather than try to fix it, just remove it.
llvm-svn: 302551
show more ...
|
#
3369f8cc |
| 08-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Use default constructor instead of explicitly creating a 1-bit APInt in udiv and urem. NFC
The default constructor does the same thing.
llvm-svn: 302487
|
#
24ae6951 |
| 08-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Remove 'else' after 'return' in udiv and urem. NFC
llvm-svn: 302486
|
#
c96a84d8 |
| 08-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Modify tcMultiplyPart's overflow detection to not depend on 'i' from the earlier loop. NFC
The value of 'i' is always the smaller of DstParts and SrcParts so we can just use that fact to wri
[APInt] Modify tcMultiplyPart's overflow detection to not depend on 'i' from the earlier loop. NFC
The value of 'i' is always the smaller of DstParts and SrcParts so we can just use that fact to write all the code in terms of SrcParts and DstParts.
llvm-svn: 302408
show more ...
|
#
0cbab7cc |
| 08-May-2017 |
Craig Topper <craig.topper@gmail.com> |
[APInt] Use std::min instead of writing the same thing with the ternary operator. NFC
llvm-svn: 302407
|