Commit 0c6302fe by Ren Zibei Committed by GitHub

Replace the implementation of the Mix function in arm64 back to 128bit multiplication (#1094)

parent ca80034f
......@@ -1090,15 +1090,10 @@ class ABSL_DLL MixingHashState : public HashStateBase<MixingHashState> {
}
ABSL_ATTRIBUTE_ALWAYS_INLINE static uint64_t Mix(uint64_t state, uint64_t v) {
#if defined(__aarch64__)
// On AArch64, calculating a 128-bit product is inefficient, because it
// requires a sequence of two instructions to calculate the upper and lower
// halves of the result.
using MultType = uint64_t;
#else
// Though the 128-bit product on AArch64 needs two instructions, it is
// still a good balance between speed and hash quality.
using MultType =
absl::conditional_t<sizeof(size_t) == 4, uint64_t, uint128>;
#endif
// We do the addition in 64-bit space to make sure the 128-bit
// multiplication is fast. If we were to do it as MultType the compiler has
// to assume that the high word is non-zero and needs to perform 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment