Revision tags: llvmorg-21-init |
|
#
8ae1cb2b |
| 17-Jan-2025 |
Iman Hosseini <imanhosseini@google.com> |
add power function to APInt (#122788)
I am trying to calculate power function for APFloat, APInt to constant fold vector reductions: https://github.com/llvm/llvm-project/pull/122450 I need this util
add power function to APInt (#122788)
I am trying to calculate power function for APFloat, APInt to constant fold vector reductions: https://github.com/llvm/llvm-project/pull/122450 I need this utility to fold N `mul`s into power.
---------
Co-authored-by: ImanHosseini <imanhosseini.17@gmail.com> Co-authored-by: Jakub Kuderski <kubakuderski@gmail.com>
show more ...
|
Revision tags: llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2 |
|
#
c180da93 |
| 15-Oct-2024 |
Nikita Popov <npopov@redhat.com> |
[APInt] Fix getAllOnes() with zero width (#112227)
This makes sure that APInt::getAllOnes() keeps working after the APInt
constructor assertions are enabled.
I'm relaxing the requirement for the
[APInt] Fix getAllOnes() with zero width (#112227)
This makes sure that APInt::getAllOnes() keeps working after the APInt
constructor assertions are enabled.
I'm relaxing the requirement for the signed case to either an all zeros
or all ones integer. This is basically saying that we can interpret the
zero-width integer as either positive or negative.
show more ...
|
Revision tags: llvmorg-19.1.1 |
|
#
37e5319a |
| 20-Sep-2024 |
Nikita Popov <npopov@redhat.com> |
[UnitTests] Fix APInt signed flags (NFC)
This makes unit tests compatible with the assertion added in https://github.com/llvm/llvm-project/pull/106524, by setting the isSigned flag to the correct va
[UnitTests] Fix APInt signed flags (NFC)
This makes unit tests compatible with the assertion added in https://github.com/llvm/llvm-project/pull/106524, by setting the isSigned flag to the correct value or changing how the value is constructed.
show more ...
|
Revision tags: llvmorg-19.1.0, llvmorg-19.1.0-rc4 |
|
#
30cc198c |
| 02-Sep-2024 |
Nikita Popov <npopov@redhat.com> |
[APInt] Add default-disabled assertion to APInt constructor (#106524)
If the uint64_t constructor is used, assert that the value is actually a
signed or unsigned N-bit integer depending on whether
[APInt] Add default-disabled assertion to APInt constructor (#106524)
If the uint64_t constructor is used, assert that the value is actually a
signed or unsigned N-bit integer depending on whether the isSigned flag
is set. Provide an implicitTrunc flag to restore the previous behavior,
where the argument is silently truncated instead.
In this commit, implicitTrunc is enabled by default, which means that
the new assertions are disabled and no actual change in behavior occurs.
The plan is to flip the default once all places violating the assertion
have been fixed. See #80309 for the scope of the necessary changes.
The primary motivation for this change is to avoid incorrectly specified
isSigned flags. A recurring problem we have is that people write
something like `APInt(BW, -1)` and this works perfectly fine -- until
the code path is hit with `BW > 64`. Most of our i128 specific
miscompilations are caused by variants of this issue.
The cost of the change is that we have to specify the correct isSigned
flag (and make sure there are no excess bits) for uses where BW is
always <= 64 as well.
show more ...
|
Revision tags: llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6 |
|
#
99934daa |
| 13-May-2024 |
Yingwei Zheng <dtcxzyw2333@gmail.com> |
[ADT] Introduce `APInt::clearHighBits` (#91938)
This patch addresses
https://github.com/llvm/llvm-project/pull/90034#discussion_r1579235844.
|
Revision tags: llvmorg-18.1.5 |
|
#
a54102a0 |
| 22-Apr-2024 |
Théo Degioanni <theo.degioanni.llvm.deluge062@simplelogin.fr> |
[llvm] Add support for zero-width integers in MathExtras.h (#87193)
MLIR uses zero-width integers, but also re-uses integer logic from LLVM
to avoid duplication. This creates issues when LLVM logic
[llvm] Add support for zero-width integers in MathExtras.h (#87193)
MLIR uses zero-width integers, but also re-uses integer logic from LLVM
to avoid duplication. This creates issues when LLVM logic is used in
MLIR on integers which can be zero-width. In order to avoid
special-casing the bitwidth-related logic in MLIR, this PR adds support
for zero-width integers in LLVM's MathExtras (and consequently APInt).
While most of the logic in theory works the same way out of the box,
because bitshifting right by the entire bitwidth in C++ is undefined
behavior instead of being zero, some special cases had to be added.
Fortunately, it seems like the performance penalty is small. In x86,
this usually yields the addition of a predicated conditional move. I
checked that no branch is inserted in Arm too.
This happens to fix a crash in `arith.extsi` canonicalization in MLIR. I
think a follow-up PR to add tests for i0 in arith would be beneficial.
show more ...
|
Revision tags: llvmorg-18.1.4 |
|
#
0b293e8c |
| 04-Apr-2024 |
Jay Foad <jay.foad@amd.com> |
[APInt] Remove multiplicativeInverse with explicit modulus (#87644)
All callers have been changed to use the new simpler overload with an
implicit modulus of 2^BitWidth. The old form was never used
[APInt] Remove multiplicativeInverse with explicit modulus (#87644)
All callers have been changed to use the new simpler overload with an
implicit modulus of 2^BitWidth. The old form was never used or tested
with non-power-of-two modulus anyway.
show more ...
|
#
1b761205 |
| 04-Apr-2024 |
Jay Foad <jay.foad@amd.com> |
[APInt] Add a simpler overload of multiplicativeInverse (#87610)
The current APInt::multiplicativeInverse takes a modulus which can be
any value, but all in-tree callers use a power of two. Moreove
[APInt] Add a simpler overload of multiplicativeInverse (#87610)
The current APInt::multiplicativeInverse takes a modulus which can be
any value, but all in-tree callers use a power of two. Moreover, most
callers want to use two to the power of the width of an existing APInt,
which is awkward because 2^N is not representable as an N-bit APInt.
Add a new overload of multiplicativeInverse which implicitly uses
2^BitWidth as the modulus.
show more ...
|
Revision tags: llvmorg-18.1.3 |
|
#
4aba595f |
| 02-Apr-2024 |
Atousa Duprat <atousa.p@gmail.com> |
[ADT] Add signed and unsigned mulh to APInt (#84719)
Fixes #84207
|
Revision tags: llvmorg-18.1.2 |
|
#
41bdcaa7 |
| 15-Mar-2024 |
Simon Pilgrim <llvm-dev@redking.me.uk> |
[ADT] APIntTest - use APInt::getMaxValue/getSignedMinValue/getSignedMaxValue instead of raw (U)INT_MAX/MIN defines
Fixes warnings on MSVC builds
|
#
6d30223f |
| 15-Mar-2024 |
long.chen <lipracer@gmail.com> |
[ADT][APInt] add sfloordiv_ov APInt's member function (#84720)
for mlir fold to avoid too many overflow state check
|
#
aff05708 |
| 14-Mar-2024 |
Atousa Duprat <atousa.p@gmail.com> |
[ADT] Add implementations for avgFloor and avgCeil to APInt (#84431)
Supports both signed and unsigned expansions.
SelectionDAG now calls the APInt implementation of these functions.
Fixes #84
[ADT] Add implementations for avgFloor and avgCeil to APInt (#84431)
Supports both signed and unsigned expansions.
SelectionDAG now calls the APInt implementation of these functions.
Fixes #84211.
show more ...
|
#
33588384 |
| 12-Mar-2024 |
Simon Pilgrim <llvm-dev@redking.me.uk> |
[ADT] Add APIntOps::abds signed absolute difference and rename absdiff -> abdu (#84791)
When I created APIntOps::absdiff, I totally missed that we already have ISD::ABDS/ABDU nodes, and we use this
[ADT] Add APIntOps::abds signed absolute difference and rename absdiff -> abdu (#84791)
When I created APIntOps::absdiff, I totally missed that we already have ISD::ABDS/ABDU nodes, and we use this term in other places/targets as well.
I've added the APIntOps::abds implementation and renamed APIntOps::absdiff to APIntOps::abdu.
Given that APIntOps::absdiff is so young I don't think we need to create a deprecation wrapper, but I can if anyone thinks it important.
I'll do a KnownBits rename patch after this.
show more ...
|
Revision tags: llvmorg-18.1.1 |
|
#
c00c901f |
| 05-Mar-2024 |
Atousa Duprat <atousa.p@gmail.com> |
[clang] Use separator for large numeric values in overflow diagnostic (#80939)
Add functionality to APInt::toString() that allows it to insert
separators between groups of digits, using the C++ lit
[clang] Use separator for large numeric values in overflow diagnostic (#80939)
Add functionality to APInt::toString() that allows it to insert
separators between groups of digits, using the C++ literal
separator ' between groups.
Fixes issue #58228
Reviewers: @AaronBallman, @cjdb, @tbaederr
show more ...
|
Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3 |
|
#
73f76cda |
| 19-Feb-2024 |
Simon Pilgrim <RKSimon@users.noreply.github.com> |
[APInt] Add APIntOps::absdiff to compute the absolute difference of 2 unsigned values (#82255)
Equivalent to "umax(A, B) - umin(A, B)"
First step towards adding knownbits support for absdiff patt
[APInt] Add APIntOps::absdiff to compute the absolute difference of 2 unsigned values (#82255)
Equivalent to "umax(A, B) - umin(A, B)"
First step towards adding knownbits support for absdiff patterns for #81765
show more ...
|
Revision tags: llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
b745c123 |
| 26-Jun-2023 |
Guillaume Chatelet <gchatelet@google.com> |
[Align] Add isAligned taking an APInt
This showed up in https://reviews.llvm.org/D153308
Reviewed By: courbet, nikic
Differential Revision: https://reviews.llvm.org/D153356
|
Revision tags: llvmorg-16.0.6, llvmorg-16.0.5 |
|
#
42e98c6a |
| 31-May-2023 |
Nikita Popov <npopov@redhat.com> |
[APInt] Support zero-width extract in extractBitsAsZExtValue()
D111241 added support for extractBits() with zero width. Extend this to extractBitsAsZExtValue() as well for consistency (in which case
[APInt] Support zero-width extract in extractBitsAsZExtValue()
D111241 added support for extractBits() with zero width. Extend this to extractBitsAsZExtValue() as well for consistency (in which case it will always return zero).
Differential Revision: https://reviews.llvm.org/D151788
show more ...
|
#
a1708340 |
| 18-May-2023 |
Thomas Preud'homme <thomas.preudhomme@arm.com> |
Add control of hex casing in APInt::toString
This will be used in implementing arbitrary precision support to FileCheck's numeric variables and expressions.
Reviewed By: foad, RKSimon
Differential
Add control of hex casing in APInt::toString
This will be used in implementing arbitrary precision support to FileCheck's numeric variables and expressions.
Reviewed By: foad, RKSimon
Differential Revision: https://reviews.llvm.org/D150879
show more ...
|
Revision tags: llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3 |
|
#
5e111eb2 |
| 20-Feb-2023 |
Kazu Hirata <kazu@google.com> |
Migrate away from the soft-deprecated functions in APInt.h (NFC)
Note that those functions on the left hand side are soft-deprecated in favor of those on the right hand side:
getMinSignedBits ->
Migrate away from the soft-deprecated functions in APInt.h (NFC)
Note that those functions on the left hand side are soft-deprecated in favor of those on the right hand side:
getMinSignedBits -> getSignificantBits getNullValue -> getZero isNullValue -> isZero isOneValue -> isOne
show more ...
|
#
7c9df774 |
| 17-Feb-2023 |
Kazu Hirata <kazu@google.com> |
[ADT] Provide C++20-style bit functions
Tihs patches adds APInt::count{l,r}_{zero,one} and APInt::popcount to be consistent with those functions in ADT/bit.h.
Once this patch lands, I'll take care
[ADT] Provide C++20-style bit functions
Tihs patches adds APInt::count{l,r}_{zero,one} and APInt::popcount to be consistent with those functions in ADT/bit.h.
Once this patch lands, I'll take care of the migration.
For now, I am intentionally leaving isPowerOf2 as is.
Differential Revision: https://reviews.llvm.org/D144165
show more ...
|
Revision tags: llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7 |
|
#
ad3e0e4b |
| 03-Jan-2023 |
Simon Pilgrim <llvm-dev@redking.me.uk> |
[APInt] Add APInt::isOneBitSet helper.
Equivalent tester for the APInt::getOneBitSet builder.
This should allow us to remove a number of cases where we're doing "Val == (1 << BitNo)" style code pat
[APInt] Add APInt::isOneBitSet helper.
Equivalent tester for the APInt::getOneBitSet builder.
This should allow us to remove a number of cases where we're doing "Val == (1 << BitNo)" style code patterns.
show more ...
|
#
a3b4feff |
| 15-Dec-2022 |
Peter Rong <PeterRong96@gmail.com> |
[APInt] Fix a bug in the unit testing introduced in 55968109d
Signed-off-by: Peter Rong <PeterRong96@gmail.com>
|
#
55968109 |
| 09-Dec-2022 |
Peter Rong <PeterRong96@gmail.com> |
[APInt] provide a safe API for zext value and sext value.
Currently, APInt::getSExtValue and getZExtValue crashes on values with more than 64 bits. Users may accidently crash the compiler with this
[APInt] provide a safe API for zext value and sext value.
Currently, APInt::getSExtValue and getZExtValue crashes on values with more than 64 bits. Users may accidently crash the compiler with this setting when the integer may be i128. As shown in https://github.com/llvm/llvm-project/issues/59316
In this patch we provide a trySExtValue and tryZExtValue to return an Optional, the user needs to explictly unwrap it and condsier the possibility where there my no value in it.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D139683
show more ...
|
#
29041bc0 |
| 10-Dec-2022 |
Krzysztof Parzyszek <kparzysz@quicinc.com> |
[APInt] Convert GetMostSignificantDifferentBit to std::optional
|
#
ea6ed399 |
| 08-Dec-2022 |
Krzysztof Parzyszek <kparzysz@quicinc.com> |
[SCEV] Convert Optional to std::optional
|