48using namespace support;
51 return (
X << R) | (
X >> (64 - R));
88 size_t Len =
Data.size();
90 const unsigned char *
P =
Data.bytes_begin();
91 const unsigned char *
const BEnd =
Data.bytes_end();
95 const unsigned char *
const Limit = BEnd - 32;
110 }
while (
P <= Limit);
124 while (
reinterpret_cast<uintptr_t
>(
P) + 8 <=
125 reinterpret_cast<uintptr_t
>(BEnd)) {
132 if (
reinterpret_cast<uintptr_t
>(
P) + 4 <=
reinterpret_cast<uintptr_t
>(BEnd)) {
157 0xb8, 0xfe, 0x6c, 0x39, 0x23, 0xa4, 0x4b, 0xbe, 0x7c, 0x01, 0x81, 0x2c, 0xf7, 0x21, 0xad, 0x1c,
158 0xde, 0xd4, 0x6d, 0xe9, 0x83, 0x90, 0x97, 0xdb, 0x72, 0x40, 0xa4, 0xa4, 0xb7, 0xb3, 0x67, 0x1f,
159 0xcb, 0x79, 0xe6, 0x4e, 0xcc, 0xc0, 0xe5, 0x78, 0x82, 0x5a, 0xd0, 0x7d, 0xcc, 0xff, 0x72, 0x21,
160 0xb8, 0x08, 0x46, 0x74, 0xf7, 0x43, 0x24, 0x8e, 0xe0, 0x35, 0x90, 0xe6, 0x81, 0x3a, 0x26, 0x4c,
161 0x3c, 0x28, 0x52, 0xbb, 0x91, 0xc3, 0x00, 0xcb, 0x88, 0xd0, 0x65, 0x8b, 0x1b, 0x53, 0x2e, 0xa3,
162 0x71, 0x64, 0x48, 0x97, 0xa2, 0x0d, 0xf9, 0x4e, 0x38, 0x19, 0xef, 0x46, 0xa9, 0xde, 0xac, 0xd8,
163 0xa8, 0xfa, 0x76, 0x3f, 0xe3, 0x9c, 0x34, 0x3f, 0xf9, 0xdc, 0xbb, 0xc7, 0xc7, 0x0b, 0x4f, 0x1d,
164 0x8a, 0x51, 0xe0, 0x4b, 0xcd, 0xb4, 0x59, 0x31, 0xc8, 0x9f, 0x7e, 0xc9, 0xd9, 0x78, 0x73, 0x64,
165 0xea, 0xc5, 0xac, 0x83, 0x34, 0xd3, 0xeb, 0xc3, 0xc5, 0x81, 0xa0, 0xff, 0xfa, 0x13, 0x63, 0xeb,
166 0x17, 0x0d, 0xdd, 0x51, 0xb7, 0xf0, 0xda, 0x49, 0xd3, 0x16, 0x55, 0x26, 0x29, 0xd4, 0x68, 0x9e,
167 0x2b, 0x16, 0xbe, 0x58, 0x7d, 0x47, 0xa1, 0xfc, 0x8f, 0xf8, 0xb8, 0xd1, 0x7a, 0xd0, 0x31, 0xce,
168 0x45, 0xcb, 0x3a, 0x8f, 0x95, 0x16, 0x04, 0x28, 0xaf, 0xd7, 0xfb, 0xca, 0xbb, 0x4b, 0x40, 0x7e,
177#if defined(__SIZEOF_INT128__) || \
178 (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 128)
179 __uint128_t product = (__uint128_t)lhs * (__uint128_t)rhs;
184 const uint64_t lo_lo = (lhs & 0xFFFFFFFF) * (rhs & 0xFFFFFFFF);
185 const uint64_t hi_lo = (lhs >> 32) * (rhs & 0xFFFFFFFF);
186 const uint64_t lo_hi = (lhs & 0xFFFFFFFF) * (rhs >> 32);
187 const uint64_t hi_hi = (lhs >> 32) * (rhs >> 32);
190 const uint64_t cross = (lo_lo >> 32) + (hi_lo & 0xFFFFFFFF) + lo_hi;
191 const uint64_t upper = (hi_lo >> 32) + (cross >> 32) + hi_hi;
192 const uint64_t lower = (cross << 32) | (lo_lo & 0xFFFFFFFF);
194 return upper ^ lower;
210 const uint8_t *secret,
uint64_t seed) {
211 const uint8_t c1 = input[0];
212 const uint8_t c2 = input[len >> 1];
213 const uint8_t c3 = input[len - 1];
223 const uint8_t *secret,
uint64_t seed) {
236 return acc ^ (acc >> 28);
240 const uint8_t *secret,
uint64_t const seed) {
254 const uint8_t *secret,
uint64_t const seed) {
279 const uint8_t *secret,
283 acc_end =
XXH3_mix16B(input + len - 16, secret + 16, seed);
286 acc_end +=
XXH3_mix16B(input + len - 32, secret + 48, seed);
289 acc_end +=
XXH3_mix16B(input + len - 48, secret + 80, seed);
292 acc_end +=
XXH3_mix16B(input + len - 64, secret + 112, seed);
303 const uint8_t *secret,
uint64_t seed) {
304 constexpr size_t XXH3_MIDSIZE_STARTOFFSET = 3;
305 constexpr size_t XXH3_MIDSIZE_LASTOFFSET = 17;
307 const unsigned nbRounds = len / 16;
308 for (
unsigned i = 0; i < 8; ++i)
309 acc +=
XXH3_mix16B(input + 16 * i, secret + 16 * i, seed);
312 for (
unsigned i = 8; i < nbRounds; ++i) {
314 secret + 16 * (i - 8) + XXH3_MIDSIZE_STARTOFFSET, seed);
325 const uint8_t *secret) {
329 acc[i ^ 1] += data_val;
330 acc[i] +=
uint32_t(data_key) * (data_key >> 32);
336 const uint8_t *secret,
size_t nbStripes) {
337 for (
size_t n = 0; n < nbStripes; ++n)
344 acc[i] ^= acc[i] >> 47;
358 for (
size_t i = 0; i < 4; ++i)
365 const uint8_t *secret,
size_t secretSize) {
366 const size_t nbStripesPerBlock =
369 const size_t nb_blocks = (len - 1) / block_len;
374 for (
size_t n = 0; n < nb_blocks; ++n) {
381 const size_t nbStripes = (len - 1 - (block_len * nb_blocks)) /
XXH_STRIPE_LEN;
386 constexpr size_t XXH_SECRET_LASTACC_START = 7;
389 XXH_SECRET_LASTACC_START);
392 constexpr size_t XXH_SECRET_MERGEACCS_START = 11;
398 auto *in = data.
data();
399 size_t len = data.
size();
#define LLVM_ATTRIBUTE_ALWAYS_INLINE
LLVM_ATTRIBUTE_ALWAYS_INLINE - On compilers where we have a directive to do so, mark a method "always...
#define LLVM_ATTRIBUTE_NOINLINE
LLVM_ATTRIBUTE_NOINLINE - On compilers where we have a directive to do so, mark a method "not for inl...
#define LLVM_LIKELY(EXPR)
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static ManagedStatic< cl::opt< uint64_t >, CreateSeed > Seed
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
StringRef - Represent a constant reference to a string, i.e.
uint64_t read64le(const void *P)
uint32_t read32le(const void *P)
This is an optimization pass for GlobalISel generic memory operations.
uint64_t xxh3_64bits(ArrayRef< uint8_t > data)
constexpr T byteswap(T V) noexcept
Reverses the bytes in the given integer value V.
uint64_t xxHash64(llvm::StringRef Data)
static uint64_t XXH3_len_9to16_64b(const uint8_t *input, size_t len, const uint8_t *secret, uint64_t const seed)
static uint64_t mergeRound(uint64_t Acc, uint64_t Val)
static uint64_t XXH3_len_4to8_64b(const uint8_t *input, size_t len, const uint8_t *secret, uint64_t seed)
static LLVM_ATTRIBUTE_NOINLINE uint64_t XXH3_hashLong_64b(const uint8_t *input, size_t len, const uint8_t *secret, size_t secretSize)
static uint64_t XXH3_len_1to3_64b(const uint8_t *input, size_t len, const uint8_t *secret, uint64_t seed)
static const uint64_t PRIME64_3
static uint64_t XXH3_mergeAccs(const uint64_t *acc, const uint8_t *key, uint64_t start)
static uint64_t XXH3_mix16B(const uint8_t *input, uint8_t const *secret, uint64_t seed)
static const uint64_t PRIME64_1
static uint64_t XXH3_avalanche(uint64_t hash)
constexpr size_t XXH3_SECRETSIZE_MIN
constexpr uint32_t PRIME32_1
constexpr uint32_t PRIME32_2
static const uint64_t PRIME64_2
static void XXH3_scrambleAcc(uint64_t *acc, const uint8_t *secret)
constexpr size_t XXH3_MIDSIZE_MAX
constexpr uint8_t kSecret[XXH_SECRET_DEFAULT_SIZE]
static LLVM_ATTRIBUTE_ALWAYS_INLINE uint64_t XXH3_len_17to128_64b(const uint8_t *input, size_t len, const uint8_t *secret, uint64_t const seed)
static LLVM_ATTRIBUTE_NOINLINE uint64_t XXH3_len_129to240_64b(const uint8_t *input, size_t len, const uint8_t *secret, uint64_t seed)
constexpr uint32_t PRIME32_3
constexpr size_t XXH_STRIPE_LEN
static const uint64_t PRIME64_4
constexpr size_t XXH_ACC_NB
static const uint64_t PRIME64_5
static uint64_t rotl64(uint64_t X, size_t R)
static uint64_t XXH64_avalanche(uint64_t hash)
constexpr size_t XXH_SECRET_DEFAULT_SIZE
constexpr uint64_t PRIME_MX1
static LLVM_ATTRIBUTE_ALWAYS_INLINE void XXH3_accumulate_512_scalar(uint64_t *acc, const uint8_t *input, const uint8_t *secret)
static uint64_t XXH3_mix2Accs(const uint64_t *acc, const uint8_t *secret)
static LLVM_ATTRIBUTE_ALWAYS_INLINE uint64_t XXH3_len_0to16_64b(const uint8_t *input, size_t len, const uint8_t *secret, uint64_t const seed)
static uint64_t XXH3_mul128_fold64(uint64_t lhs, uint64_t rhs)
static uint64_t round(uint64_t Acc, uint64_t Input)
constexpr size_t XXH_SECRET_CONSUME_RATE
constexpr uint64_t PRIME_MX2
static LLVM_ATTRIBUTE_ALWAYS_INLINE void XXH3_accumulate_scalar(uint64_t *acc, const uint8_t *input, const uint8_t *secret, size_t nbStripes)