summaryrefslogtreecommitdiff
path: root/absl/container
diff options
context:
space:
mode:
authorGravatar Connal de Souza <connaldesouza@google.com>2023-02-23 09:52:08 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-02-23 09:53:06 -0800
commit0f35765048ea9b9fce70dc7c7781bed3321d99cd (patch)
treef9c2e149a20718aadd295e2974d58bf067d19651 /absl/container
parent0ecfe2358af39dcc61c581d242d11d3f7211683e (diff)
Optimize ConvertSpecialToEmptyAndFullToDeleted on Arm
BM_DropDeletes 73.4µs ± 0% 68.9µs ± 1% -6.22% (p=0.008 n=5+5) PiperOrigin-RevId: 511813266 Change-Id: Id28cece454d583e2dfe060e27cfc4720f987f009
Diffstat (limited to 'absl/container')
-rw-r--r--absl/container/internal/raw_hash_set.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h
index e5306a4f..f4de2d65 100644
--- a/absl/container/internal/raw_hash_set.h
+++ b/absl/container/internal/raw_hash_set.h
@@ -675,9 +675,10 @@ struct GroupAArch64Impl {
void ConvertSpecialToEmptyAndFullToDeleted(ctrl_t* dst) const {
uint64_t mask = vget_lane_u64(vreinterpret_u64_u8(ctrl), 0);
constexpr uint64_t msbs = 0x8080808080808080ULL;
- constexpr uint64_t lsbs = 0x0101010101010101ULL;
- auto x = mask & msbs;
- auto res = (~x + (x >> 7)) & ~lsbs;
+ constexpr uint64_t slsbs = 0x0202020202020202ULL;
+ constexpr uint64_t midbs = 0x7e7e7e7e7e7e7e7eULL;
+ auto x = slsbs & (mask >> 6);
+ auto res = (x + midbs) | msbs;
little_endian::Store64(dst, res);
}