History log of /llvm-project/llvm/unittests/Support/MathExtrasTest.cpp (Results 1 – 25 of 58)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3
# 7dd6340b 19-Aug-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

MathExtras: template'ize alignToPowerOf2 (#97814)

Follow up on 5627794 (MathExtras: avoid unnecessarily widening types) to
change the overflow behavior of alignToPowerOf2 to only overflow if the
r

MathExtras: template'ize alignToPowerOf2 (#97814)

Follow up on 5627794 (MathExtras: avoid unnecessarily widening types) to
change the overflow behavior of alignToPowerOf2 to only overflow if the
result is not representable in the return type. This allows us to
template'ize it, and avoid unnecessarily widening the types of
arguments.

show more ...


Revision tags: llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# f1eed011 09-Jul-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

MathExtras: add overflow query for signed-div (#97901)

5221634 (Do not trigger UB during AffineExpr parsing) noticed that
divideCeilSigned and divideFloorSigned would overflow when Numerator =
INT

MathExtras: add overflow query for signed-div (#97901)

5221634 (Do not trigger UB during AffineExpr parsing) noticed that
divideCeilSigned and divideFloorSigned would overflow when Numerator =
INT_MIN, and Denominator = -1. This observation has already been made by
DynamicAPInt, and it has code to check this. To avoid checks in multiple
callers, centralize this query in MathExtras, and change
divideCeilSigned/divideFloorSigned to assert on overflow.

show more ...


# 56277948 29-Jun-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

MathExtras: avoid unnecessarily widening types (#95426)

Several multi-argument functions unnecessarily widen types beyond the
argument types. Template'ize the functions, and use std::common_type_t

MathExtras: avoid unnecessarily widening types (#95426)

Several multi-argument functions unnecessarily widen types beyond the
argument types. Template'ize the functions, and use std::common_type_t
to avoid this, hence optimizing the functions. A requirement of this
patch is to change the overflow behavior of alignTo to only overflow
when the result isn't representable in the return type.

show more ...


Revision tags: llvmorg-18.1.8
# bfd95a00 15-Jun-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

MathExtras: rewrite some methods to never overflow (#95556)

Rewrite divideCeil, divideNearest, divideFloorSigned, and
divideCeilSigned to never overflow.


# ebb5385c 14-Jun-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

MathExtras/test: increase coverage (#95425)

Increase test coverage, and cover possible overflow cases in preparation
for another patch optimizing for bitwidth.


# 0fb216fb 11-Jun-2024 Ramkumar Ramachandra <ramkumar.ramachandra@codasip.com>

mlir/MathExtras: consolidate with llvm/MathExtras (#95087)

This patch is part of a project to move the Presburger library into
LLVM.


Revision tags: llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5
# 4127a69d 23-Apr-2024 Kazu Hirata <kazu@google.com>

[Support] Fix a warning

This patch fixes:

third-party/unittest/googletest/include/gtest/gtest.h:1379:11:
error: comparison of integers of different signs: 'const int' and
'const unsigned long

[Support] Fix a warning

This patch fixes:

third-party/unittest/googletest/include/gtest/gtest.h:1379:11:
error: comparison of integers of different signs: 'const int' and
'const unsigned long' [-Werror,-Wsign-compare]

show more ...


# 7c585467 22-Apr-2024 Théo Degioanni <theo.degioanni.llvm.deluge062@simplelogin.fr>

[nfc][llvm] Fix a typo in MathExtras.h testing (#89653)

I made a small typo when writing a test for MathExtras.h, sorry!


# 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, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, 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, llvmorg-16.0.6, llvmorg-16.0.5, 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
# 0f52c1f8 14-Feb-2023 Kazu Hirata <kazu@google.com>

[llvm] Deprecate {Bits,Float,Double}To{Bits,Float,Double} (NFC)

Differential Revision: https://reviews.llvm.org/D143990


# b49b429f 13-Feb-2023 Kazu Hirata <kazu@google.com>

[llvm] Deprecate PowerOf2Floor and ByteSwap_{16,32,64}

llvm/include/llvm/ADT/bit.h now has equivalent functions
forward-ported from C++20.

Differential Revision: https://reviews.llvm.org/D143858


# ec116ea6 12-Feb-2023 Kazu Hirata <kazu@google.com>

[llvm] Deprecate llvm::count{Leading,Trailing}{Zeros,Ones} and llvm::countPopulation

llvm/include/llvm/ADT/bit.h now has equivalent functions
forward-ported from C++20.

Differential Revision: https

[llvm] Deprecate llvm::count{Leading,Trailing}{Zeros,Ones} and llvm::countPopulation

llvm/include/llvm/ADT/bit.h now has equivalent functions
forward-ported from C++20.

Differential Revision: https://reviews.llvm.org/D143837

show more ...


Revision tags: llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1
# 32ac9db7 26-Jan-2023 Kazu Hirata <kazu@google.com>

[Support] Remove findFirstSet and findLastSet

This patch removes findFirstSet and findLastSet as there are no uses
left in LLVM.

I am not aware of any uses of findFirstSet and findLastSet in the
op

[Support] Remove findFirstSet and findLastSet

This patch removes findFirstSet and findLastSet as there are no uses
left in LLVM.

I am not aware of any uses of findFirstSet and findLastSet in the
open-source world outside LLVM, so I am skipping the deprecation step.

Differential Revision: https://reviews.llvm.org/D142603

show more ...


Revision tags: llvmorg-17-init, llvmorg-15.0.7
# d59a196b 01-Dec-2022 Alexander Shaposhnikov <ashaposhnikov@google.com>

[Support][MathExtras] Add variadic SaturatingAdd

Add variadic SaturatingAdd.

Test plan: ninja check-llvm-unit check-all

Differential revision: https://reviews.llvm.org/D139036


Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2, llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3, llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1
# d1d7188b 08-Feb-2022 Simon Pilgrim <llvm-dev@redking.me.uk>

Fix signed/unsigned comparison warnings on ppc buildbots


# fd2bb51f 08-Feb-2022 Simon Pilgrim <llvm-dev@redking.me.uk>

[ADT] Add APInt/MathExtras isShiftedMask variant returning mask offset/length

In many cases, calls to isShiftedMask are immediately followed with checks to determine the size and position of the bit

[ADT] Add APInt/MathExtras isShiftedMask variant returning mask offset/length

In many cases, calls to isShiftedMask are immediately followed with checks to determine the size and position of the bitmask.

This patch adds variants of APInt::isShiftedMask, isShiftedMask_32 and isShiftedMask_64 that return these values as additional arguments.

I've updated a number of cases that were either performing seperate size/position calculations or had created their own local wrapper versions of these.

Differential Revision: https://reviews.llvm.org/D119019

show more ...


# 0b989a03 04-Feb-2022 Simon Pilgrim <llvm-dev@redking.me.uk>

[Support] Add isShiftedMask_32/isShiftedMask_64 unit test coverage


Revision tags: llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2, llvmorg-13.0.1-rc1, llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1
# 05de4b41 17-May-2021 Benjamin Kramer <benny.kra@googlemail.com>

Put back the trailing commas on TYPED_TEST_SUITE

This avoids a -pedantic warning:
warning: ISO C++11 requires at least one argument for the "..." in a variadic macro

See also https://github.com/goo

Put back the trailing commas on TYPED_TEST_SUITE

This avoids a -pedantic warning:
warning: ISO C++11 requires at least one argument for the "..." in a variadic macro

See also https://github.com/google/googletest/issues/2271

show more ...


# d4d80a29 14-May-2021 Benjamin Kramer <benny.kra@googlemail.com>

Bump googletest to 1.10.0


Revision tags: llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6, llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3, llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4, llvmorg-10.0.1-rc3, llvmorg-10.0.1-rc2, llvmorg-10.0.1-rc1, llvmorg-10.0.0, llvmorg-10.0.0-rc6, llvmorg-10.0.0-rc5, llvmorg-10.0.0-rc4, llvmorg-10.0.0-rc3
# e3a9b0f3 28-Feb-2020 Reid Kleckner <rnk@google.com>

[Support] Remove byte swapping from MathExtras.h

MathExtras.h was just wrapping SwapByteOrder.h functionality, so have
the callers use it directly. Use the MathExtras.h name (ByteSwap_NN) as
the st

[Support] Remove byte swapping from MathExtras.h

MathExtras.h was just wrapping SwapByteOrder.h functionality, so have
the callers use it directly. Use the MathExtras.h name (ByteSwap_NN) as
the standard naming, since it appears to be the most popular.

show more ...


Revision tags: llvmorg-10.0.0-rc2, llvmorg-10.0.0-rc1, llvmorg-11-init, llvmorg-9.0.1, llvmorg-9.0.1-rc3, llvmorg-9.0.1-rc2, llvmorg-9.0.1-rc1
# 415df89e 14-Oct-2019 Guillaume Chatelet <gchatelet@google.com>

[Alignment][NFC] Support compile time constants

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-

[Alignment][NFC] Support compile time constants

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68936

llvm-svn: 374758

show more ...


# d1f23bd2 03-Oct-2019 Guillaume Chatelet <gchatelet@google.com>

Revert "[Alignment][NFC] Allow constexpr Align"

This reverts commit b3af236fb5fc6e50fcc1b54d868f0bff557f3fb1.

llvm-svn: 373619


# b3af236f 03-Oct-2019 Guillaume Chatelet <gchatelet@google.com>

[Alignment][NFC] Allow constexpr Align

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/1338

[Alignment][NFC] Allow constexpr Align

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D68329

llvm-svn: 373580

show more ...


Revision tags: llvmorg-9.0.0, llvmorg-9.0.0-rc6, llvmorg-9.0.0-rc5, llvmorg-9.0.0-rc4, llvmorg-9.0.0-rc3, llvmorg-9.0.0-rc2
# fe968c36 31-Jul-2019 JF Bastien <jfbastien@apple.com>

[Support] Added overflow checking add, sub and mul.

Added AddOverflow, SubOverflow and MulOverflow to compute truncated results and return a flag indicating whether overflow occured.

Differential

[Support] Added overflow checking add, sub and mul.

Added AddOverflow, SubOverflow and MulOverflow to compute truncated results and return a flag indicating whether overflow occured.

Differential Revision: https://reviews.llvm.org/D65494

llvm-svn: 367470

show more ...


Revision tags: llvmorg-9.0.0-rc1, llvmorg-10-init, llvmorg-8.0.1, llvmorg-8.0.1-rc4, llvmorg-8.0.1-rc3, llvmorg-8.0.1-rc2, llvmorg-8.0.1-rc1, llvmorg-8.0.0, llvmorg-8.0.0-rc5, llvmorg-8.0.0-rc4, llvmorg-8.0.0-rc3, llvmorg-7.1.0, llvmorg-7.1.0-rc1, llvmorg-8.0.0-rc2, llvmorg-8.0.0-rc1
# 2946cd70 19-Jan-2019 Chandler Carruth <chandlerc@gmail.com>

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the ne

Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351636

show more ...


123