[libc-commits] [PATCH] D152459: [libc] Add Int<> type and fix (U)Int<128> compatibility issues.
Tue Ly via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Jun 9 07:21:12 PDT 2023
lntue added inline comments.
================
Comment at: libc/test/src/math/TruncTest.h:68
constexpr UIntType COUNT = 100'000;
- constexpr UIntType STEP = UIntType(-1) / COUNT;
+ const UIntType STEP = UIntType(-1) / COUNT;
for (UIntType i = 0, v = 0; i <= COUNT; ++i, v += STEP) {
----------------
sivachandra wrote:
> lntue wrote:
> > sivachandra wrote:
> > > I did not do a detailed review but why were these `constexpr` decls converted to `const` decls?
> > Because these use the division operator, which using `clz()` internally, which in turn calls `__builtin_clz*` that are not `constexpr`.
> We should be able to implement `cpp::is_constant_evaluated` using `__builtin_is_constant_evaluated` and use it to retain the `constexpr` nature where relevant. We should ideally do that first before adding `BigInt`.
Turns out that `__builtin_clz*` are already `constexpr`, so marking all our `clz` functions `constexpr` is enough.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152459/new/
https://reviews.llvm.org/D152459
More information about the libc-commits
mailing list