History log of /llvm-project/llvm/unittests/Support/MathExtrasTest.cpp (Results 26 – 50 of 58)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-7.0.1, llvmorg-7.0.1-rc3, llvmorg-7.0.1-rc2, llvmorg-7.0.1-rc1, llvmorg-7.0.0, llvmorg-7.0.0-rc3, llvmorg-7.0.0-rc2, llvmorg-7.0.0-rc1, llvmorg-6.0.1, llvmorg-6.0.1-rc3, llvmorg-6.0.1-rc2, llvmorg-6.0.1-rc1, llvmorg-5.0.2, llvmorg-5.0.2-rc2, llvmorg-5.0.2-rc1, llvmorg-6.0.0, llvmorg-6.0.0-rc3, llvmorg-6.0.0-rc2, llvmorg-6.0.0-rc1, llvmorg-5.0.1, llvmorg-5.0.1-rc3, llvmorg-5.0.1-rc2, llvmorg-5.0.1-rc1, llvmorg-5.0.0, llvmorg-5.0.0-rc5, llvmorg-5.0.0-rc4, llvmorg-5.0.0-rc3, llvmorg-5.0.0-rc2, llvmorg-5.0.0-rc1
# fa00e34b 03-Jul-2017 Zvi Rackover <zvi.rackover@intel.com>

MathExtras UnitTest: Assert that isPowerOf2(0) is false. NFC.

Summary:
This is a follow-up on D34077. Elena observed that the
correctness of the code relies on isPowerOf2(0) returning false.
Adding

MathExtras UnitTest: Assert that isPowerOf2(0) is false. NFC.

Summary:
This is a follow-up on D34077. Elena observed that the
correctness of the code relies on isPowerOf2(0) returning false.
Adding a test to cover this corner-case.

Reviewers: delena, davide, craig.topper

Reviewed By: davide

Subscribers: llvm-commits

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

llvm-svn: 307046

show more ...


Revision tags: llvmorg-4.0.1, llvmorg-4.0.1-rc3
# 9a67b073 06-Jun-2017 Chandler Carruth <chandlerc@gmail.com>

Re-sort #include lines for unittests. This uses a slightly modified
clang-format (https://reviews.llvm.org/D33932) to keep primary headers
at the top and handle new utility headers like 'gmock' consi

Re-sort #include lines for unittests. This uses a slightly modified
clang-format (https://reviews.llvm.org/D33932) to keep primary headers
at the top and handle new utility headers like 'gmock' consistently with
other utility headers.

No other change was made. I did no manual edits, all of this is
clang-format.

This should allow other changes to have more clear and focused diffs,
and is especially motivated by moving some headers into more focused
libraries.

llvm-svn: 304786

show more ...


Revision tags: llvmorg-4.0.1-rc2, llvmorg-4.0.1-rc1
# e25268de 19-Apr-2017 Benjamin Kramer <benny.kra@googlemail.com>

[MathExtras] Fix undefined behavior (shift by bit width)

While there add some unit tests for uint64_t. Found by ubsan.

llvm-svn: 300721


# f19b0c7f 19-Apr-2017 Zachary Turner <zturner@google.com>

[Support] Add some helpers to generate bitmasks.

Frequently you you want a bitmask consisting of a specified
number of 1s, either at the beginning or end of a word.

The naive way to do this is to w

[Support] Add some helpers to generate bitmasks.

Frequently you you want a bitmask consisting of a specified
number of 1s, either at the beginning or end of a word.

The naive way to do this is to write

template<typename T>
T leadingBitMask(unsigned N) {
return (T(1) << N) - 1;
}

but using this function you cannot produce a word with every
bit set to 1 (i.e. leadingBitMask<uint8_t>(8)) because left
shift is undefined when N is greater than or equal to the
number of bits in the word.

This patch provides an efficient, branch-free implementation
that works for all values of N in [0, CHAR_BIT*sizeof(T)]

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

llvm-svn: 300710

show more ...


Revision tags: llvmorg-4.0.0, llvmorg-4.0.0-rc4, llvmorg-4.0.0-rc3, llvmorg-4.0.0-rc2, llvmorg-4.0.0-rc1, llvmorg-3.9.1, llvmorg-3.9.1-rc3, llvmorg-3.9.1-rc2, llvmorg-3.9.1-rc1
# 0970ddb2 11-Nov-2016 Davide Italiano <davide@freebsd.org>

[ADT/MathExtras] Make buildbot happy again.

llvm-svn: 286559


# 62ede4e3 11-Nov-2016 Davide Italiano <davide@freebsd.org>

[ADT/MathExtras] Add tests for PowerOf2Floor (previously untested).

llvm-svn: 286551


# 1fb1b9cd 11-Nov-2016 Davide Italiano <davide@freebsd.org>

[ADT/MathExtras] Introduce PowerOf2Ceil.

To be used in lld (and probably somewhere else in llvm).

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

llvm-svn: 286549


Revision tags: llvmorg-3.9.0, llvmorg-3.9.0-rc3, llvmorg-3.9.0-rc2, llvmorg-3.9.0-rc1
# 1e50e3b3 17-Jul-2016 Justin Lebar <jlebar@google.com>

Add tests for max/minIntN(64).

Summary:
Given that we had a bug on max/minUIntN(64), these should have tests
too.

Reviewers: rnk

Subscribers: dylanmckay, llvm-commits

Differential Revision: https

Add tests for max/minIntN(64).

Summary:
Given that we had a bug on max/minUIntN(64), these should have tests
too.

Reviewers: rnk

Subscribers: dylanmckay, llvm-commits

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

llvm-svn: 275723

show more ...


# cbba3c4a 17-Jul-2016 Justin Lebar <jlebar@google.com>

Fix isShiftedInt and isShiftedUint for widths > 32.

Summary:
Previously we were doing 1 << S. "1" is an int, so this doesn't work
when S >= 32.

This patch also adds some static_asserts to these fu

Fix isShiftedInt and isShiftedUint for widths > 32.

Summary:
Previously we were doing 1 << S. "1" is an int, so this doesn't work
when S >= 32.

This patch also adds some static_asserts to these functions to ensure
that we don't hit UB by shifting left too much.

Reviewers: rnk

Subscribers: llvm-commits, dylanmckay

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

llvm-svn: 275719

show more ...


# 8d56f47c 16-Jul-2016 Justin Lebar <jlebar@google.com>

Don't do uint64_t(1) << 64 in maxUIntN.

Summary:
This shift is undefined behavior (and, as compiled by clang, gives the
wrong answer for maxUIntN(64)).

Reviewers: mkuper

Subscribers: llvm-commits,

Don't do uint64_t(1) << 64 in maxUIntN.

Summary:
This shift is undefined behavior (and, as compiled by clang, gives the
wrong answer for maxUIntN(64)).

Reviewers: mkuper

Subscribers: llvm-commits, jroelofs, rsmith

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

llvm-svn: 275656

show more ...


Revision tags: llvmorg-3.8.1, llvmorg-3.8.1-rc1
# a9ba12d8 02-Jun-2016 Dylan McKay <dylanmckay34@gmail.com>

Add tests to Support/MathExtras

In r271380, I added several functions to get the minimum/maximum values
of n-width integers.

This just adds tests for them.

llvm-svn: 271505


# fa994256 14-Mar-2016 NAKAMURA Takumi <geek4civic@gmail.com>

MathExtrasTest.cpp: Use EXPECT_DOUBLE_EQ here, instead of EXPECT_FLOAT_EQ.

llvm-svn: 263508


Revision tags: llvmorg-3.8.0, llvmorg-3.8.0-rc3, llvmorg-3.8.0-rc2, llvmorg-3.8.0-rc1
# da00f2fd 14-Jan-2016 Rui Ueyama <ruiu@google.com>

Update to use new name alignTo().

llvm-svn: 257804


# 7bee3168 12-Jan-2016 Nathan Slingerland <slingn@gmail.com>

[Support] Add saturating multiply-add support function

Summary: Add SaturatingMultiplyAdd convenience function template since A + (X * Y) comes up frequently when doing weighted arithmetic.

Reviewe

[Support] Add saturating multiply-add support function

Summary: Add SaturatingMultiplyAdd convenience function template since A + (X * Y) comes up frequently when doing weighted arithmetic.

Reviewers: davidxl, silvas

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15385

llvm-svn: 257532

show more ...


# 644badbf 09-Dec-2015 Nathan Slingerland <slingn@gmail.com>

[Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for returning overflow state

Summary:
Improve SaturatingAdd()/SaturatingMultiply() to use bool * to optionally return overflow re

[Support] Change SaturatingAdd()/SaturatingMultiply() to use pointer for returning overflow state

Summary:
Improve SaturatingAdd()/SaturatingMultiply() to use bool * to optionally return overflow result.
This should make it clearer that the value is returned at callsites and reduces the size of the implementation.

Reviewers: davidxl, silvas

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D15219

llvm-svn: 255128

show more ...


Revision tags: llvmorg-3.7.1
# 2e1d85a0 23-Nov-2015 Nathan Slingerland <slingn@gmail.com>

[Support] Add optional argument to SaturatingAdd() and SaturatingMultiply() to indicate that overflow occurred

Summary: Adds the ability for callers to detect when saturation occurred on the result

[Support] Add optional argument to SaturatingAdd() and SaturatingMultiply() to indicate that overflow occurred

Summary: Adds the ability for callers to detect when saturation occurred on the result of saturating addition/multiplication.

Reviewers: davidxl, silvas, rsmith

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D14931

llvm-svn: 253921

show more ...


# 8a065483 23-Nov-2015 Nathan Slingerland <slingn@gmail.com>

[Support] Fix SaturatingMultiply<T>() to be correct (and fast), Re-enable Unit Tests

Summary:
This change fixes the SaturatingMultiply<T>() function template to not cause undefined behavior with T=u

[Support] Fix SaturatingMultiply<T>() to be correct (and fast), Re-enable Unit Tests

Summary:
This change fixes the SaturatingMultiply<T>() function template to not cause undefined behavior with T=uint16_t.
Thanks to Richard Smith's contribution, it also no longer requires an integer division.

Patch by Richard Smith.

Reviewers: silvas, davidxl

Subscribers: rsmith, davidxl, llvm-commits

Differential Revision: http://reviews.llvm.org/D14845

llvm-svn: 253870

show more ...


Revision tags: llvmorg-3.7.1-rc2
# be9db3c0 20-Nov-2015 Daniel Sanders <daniel.sanders@imgtec.com>

Revert the revert 253497 and 253539 - These commits aren't the cause of the clang-cmake-mips failures.

Sorry for the noise.

llvm-svn: 253662


# ad6c04de 20-Nov-2015 Daniel Sanders <daniel.sanders@imgtec.com>

Revert 253497 and 253539 to try to fix clang-cmake-mips buildbot.

It caused link errors of the form:
InstrProfiling.c:(.text.__llvm_profile_instrument_target+0x1c0): undefined reference to `__sync_f

Revert 253497 and 253539 to try to fix clang-cmake-mips buildbot.

It caused link errors of the form:
InstrProfiling.c:(.text.__llvm_profile_instrument_target+0x1c0): undefined reference to `__sync_fetch_and_add_8'

We had a network outage at the time of the commit so the first build to show a
problem is http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/10827

llvm-svn: 253656

show more ...


# 00aecfc3 19-Nov-2015 Nathan Slingerland <slingn@gmail.com>

[Support] Disable SaturatingMultiply() unit test while investigating

Ubsan detected undefined behavior in the MathExtras SaturatingMultiply test.

This change disables the test while it is being inv

[Support] Disable SaturatingMultiply() unit test while investigating

Ubsan detected undefined behavior in the MathExtras SaturatingMultiply test.

This change disables the test while it is being investigated.

llvm-svn: 253539

show more ...


# 617c6001 18-Nov-2015 Nathan Slingerland <slingn@gmail.com>

[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions (2nd try)

Summary:
This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. I

[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions (2nd try)

Summary:
This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. It also updates the instrumentation and sample profile merge implementations to use them.

Reviewers: dnovillo, bogner, davidxl

Subscribers: davidxl, llvm-commits

Differential Revision: http://reviews.llvm.org/D14720

llvm-svn: 253497

show more ...


# a75d2564 18-Nov-2015 Nathan Slingerland <slingn@gmail.com>

Revert "[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions"

Not ready for merge.

llvm-svn: 253415


# fda1b81f 18-Nov-2015 Nathan Slingerland <slingn@gmail.com>

[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions

Summary:
This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. It also upd

[llvm-profdata] Add SaturatingAdd/SaturatingMultiply Helper Functions

Summary:
This change adds MathExtras helper functions for handling unsigned, saturating addition and multiplication. It also updates the instrumentation and sample profile merge implementations to use them.

No functional changes.

Reviewers: dnovillo, bogner, davidxl

Subscribers: davidxl, llvm-commits

Differential Revision: http://reviews.llvm.org/D14720

llvm-svn: 253412

show more ...


Revision tags: llvmorg-3.7.1-rc1
# cce239c4 29-Sep-2015 Maksim Panchenko <maks@fb.com>

HHVM calling conventions.

HHVM calling convention, hhvmcc, is used by HHVM JIT for
functions in translated cache. We currently support LLVM back end to
generate code for X86-64 and may support other

HHVM calling conventions.

HHVM calling convention, hhvmcc, is used by HHVM JIT for
functions in translated cache. We currently support LLVM back end to
generate code for X86-64 and may support other architectures in the
future.

In HHVM calling convention any GP register could be used to pass and
return values, with the exception of R12 which is reserved for
thread-local area and is callee-saved. Other than R12, we always
pass RBX and RBP as args, which are our virtual machine's stack pointer
and frame pointer respectively.

When we enter translation cache via hhvmcc function, we expect
the stack to be aligned at 16 bytes, i.e. skewed by 8 bytes as opposed
to standard ABI alignment. This affects stack object alignment and stack
adjustments for function calls.

One extra calling convention, hhvm_ccc, is used to call C++ helpers from
HHVM's translation cache. It is almost identical to standard C calling
convention with an exception of first argument which is passed in RBP
(before we use RDI, RSI, etc.)

Differential Revision: http://reviews.llvm.org/D12681

llvm-svn: 248832

show more ...


Revision tags: llvmorg-3.7.0, llvmorg-3.7.0-rc4, llvmorg-3.7.0-rc3, studio-1.4, llvmorg-3.7.0-rc2, llvmorg-3.7.0-rc1, llvmorg-3.6.2, llvmorg-3.6.2-rc1, llvmorg-3.6.1, llvmorg-3.6.1-rc1, llvmorg-3.5.2, llvmorg-3.5.2-rc1, llvmorg-3.6.0, llvmorg-3.6.0-rc4, llvmorg-3.6.0-rc3
# 193c94b4 12-Feb-2015 Benjamin Kramer <benny.kra@googlemail.com>

Try to fix the MSVC build.

0xFFFFFFFFFFFFFFFFLL doesn't fit in a long long so it should have
type 'unsigned long long'. MSVC thinks it's a (signed) __int64.

llvm-svn: 228950


123