This is an archive of the discontinued LLVM Phabricator instance.

[libc.search] [PATCH 4/6] add platform dependent defintions for swisstable
Needs ReviewPublic

Authored by SchrodingerZhu on Oct 21 2022, 1:31 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch includes platform dependent parts of swisstable. The common.h
includes defintions for BitMask, which is used to match ctrl bytes in
batch to determine empty/delete/full status (distinguished by the highest bit)
or check if there is matches of the second-level 7-bit hash. Different
platform may use different number of bits to represent the result: for SSE2,
a single bit is used; for other platforms, the match result are stored in
8 bits. To make the bitmask iteratable (that is you can iterate the offsets of matched byte),
at most one bit can be set for each group of bits that represents the result.
To check the existence or locate the lowest offset of such match, however,
there will be no need to keep only one set bit within the group.

Group structure is defined for different platforms separately to utilize the SIMD
instruction if possible. It is a just wrapper to load the memory of ctrl bytes and then
produce the BitMask.

Diff Detail