Support Clang 16 (#4592)

This commit is contained in:
Mariusz Glebocki 2023-10-20 21:47:09 +02:00 committed by GitHub
parent 83a0085c4d
commit c7a0613c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 18 deletions

View File

@ -371,10 +371,9 @@ _MY_CXX_CHECK_OPT(CFG_CXXFLAGS_WEXTRA,-Wthread-safety)
AC_SUBST(CFG_CXXFLAGS_WEXTRA)
# Flags for coroutine support for dynamic scheduling
_MY_CXX_CHECK_IFELSE(
-fcoroutines-ts,
[CFG_CXXFLAGS_COROUTINES="-fcoroutines-ts"],
[CFG_CXXFLAGS_COROUTINES="-fcoroutines"])
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines-ts)
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines)
_MY_CXX_CHECK_SET(CFG_CXXFLAGS_COROUTINES,-fcoroutines-ts -Wno-deprecated-experimental-coroutine)
AC_SUBST(CFG_CXXFLAGS_COROUTINES)
# HAVE_COROUTINES
@ -442,7 +441,10 @@ m4_foreach([cflag],[
[-mno-cet],
[-Qunused-arguments],
[-Wno-bool-operation],
[-Wno-c++11-narrowing],
[-Wno-constant-logical-operand],
[-Wno-non-pod-varargs],
[-Wno-overloaded-virtual],
[-Wno-parentheses-equality],
[-Wno-shadow],
[-Wno-sign-compare],

View File

@ -250,20 +250,6 @@ template <class T_Value, uint64_t T_numValues>
class VlRandC final {
T_Value m_remaining = 0; // Number of values to pull before re-randomize
T_Value m_lfsr = 1; // LFSR state
// Polynomials are first listed at https://users.ece.cmu.edu/~koopman/lfsr/
static constexpr uint64_t s_polynomials[] = {
0x0ULL, // 0 never used (constant, no randomization)
0x0ULL, // 1
0x3ULL, 0x5ULL, 0x9ULL, 0x12ULL, 0x21ULL,
0x41ULL, 0x8eULL, 0x108ULL, 0x204ULL, 0x402ULL,
0x829ULL, 0x100dULL, 0x2015ULL, 0x4001ULL,
0x8016ULL, // 16
0x10004ULL, 0x20040ULL, 0x40013ULL, 0x80004ULL, 0x100002ULL,
0x200001ULL, 0x400010ULL, 0x80000dULL, 0x1000004ULL, 0x2000023ULL,
0x4000013ULL, 0x8000004ULL, 0x10000002ULL, 0x20000029ULL, 0x40000004ULL,
0x80000057ULL, // 32
0x100000029ULL // 33
};
public:
// CONSTRUCTORS
@ -274,6 +260,20 @@ public:
// METHODS
T_Value randomize(VlRNG& rngr) {
if (VL_UNLIKELY(!m_remaining)) reseed(rngr);
// Polynomials are first listed at https://users.ece.cmu.edu/~koopman/lfsr/
static constexpr uint64_t s_polynomials[] = {
0x0ULL, // 0 never used (constant, no randomization)
0x0ULL, // 1
0x3ULL, 0x5ULL, 0x9ULL, 0x12ULL, 0x21ULL,
0x41ULL, 0x8eULL, 0x108ULL, 0x204ULL, 0x402ULL,
0x829ULL, 0x100dULL, 0x2015ULL, 0x4001ULL,
0x8016ULL, // 16
0x10004ULL, 0x20040ULL, 0x40013ULL, 0x80004ULL, 0x100002ULL,
0x200001ULL, 0x400010ULL, 0x80000dULL, 0x1000004ULL, 0x2000023ULL,
0x4000013ULL, 0x8000004ULL, 0x10000002ULL, 0x20000029ULL, 0x40000004ULL,
0x80000057ULL, // 32
0x100000029ULL // 33
};
constexpr uint32_t clogWidth = VL_CLOG2_CE_Q(T_numValues) + 1;
constexpr uint32_t lfsrWidth = (clogWidth < 2) ? 2 : clogWidth;
constexpr T_Value polynomial = static_cast<T_Value>(s_polynomials[lfsrWidth]);