[libc-commits] [PATCH] D136490: [libc.search] [PATCH 4/6] add platform dependent defintions for swisstable

Schrodinger ZHU Yifan via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Oct 21 13:31:15 PDT 2022


SchrodingerZhu created this revision.
Herald added projects: libc-project, All.
Herald added a subscriber: libc-commits.
SchrodingerZhu requested review of this revision.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D136490

Files:
  libc/src/__support/swisstable/asimd.h
  libc/src/__support/swisstable/common.h
  libc/src/__support/swisstable/dispatch.h
  libc/src/__support/swisstable/generic.h
  libc/src/__support/swisstable/sse2.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136490.469749.patch
Type: text/x-patch
Size: 17460 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20221021/8f682bf5/attachment.bin>


More information about the libc-commits mailing list