[HN Gopher] SWAR: Find any byte from set
       ___________________________________________________________________
        
       SWAR: Find any byte from set
        
       Author : g0xA52A2A
       Score  : 33 points
       Date   : 2023-03-07 06:59 UTC (1 days ago)
        
 (HTM) web link (0x80.pl)
 (TXT) w3m dump (0x80.pl)
        
       | zX41ZdbW wrote:
       | Interesting to compare the SWAR approach with 64-bit register, a
       | similar approach with 128-bit register (SSE-2), and string search
       | instructions (SSE-4.2). This implementation in ClickHouse can be
       | used as a reference:
       | 
       | https://github.com/ClickHouse/ClickHouse/blob/a04b38db907b8e...
       | 
       | Obviously, SWAR should be slower (due to register size), but how
       | slower?
        
         | hummus_bae wrote:
         | All modern CPU architectures have builtin fast string compare
         | instructions.
         | 
         | Here is a table from the Intel manual (bolded are the relevant
         | compare instructions):
         | 
         | https://msdk.intel.com/en-us/library/cc286809.aspx
         | 
         | > SSE-4.2: Compare strings using dqa (32-bit mode), dqq (64-bit
         | mode), dqu, dsx
         | 
         | > SSE-3: Compare strings using cmpsdx, cmpsd, scansigndx,
         | scansignd
         | 
         | > SSE-2: Compare strings using pmaxsw, pand, pmin, pmins
         | 
         | > SSE-1: Compare strings using pandn, pavg, pandnpand,
         | pandnpandn, pandn, pandnpandndivr, ...
        
       ___________________________________________________________________
       (page generated 2023-03-08 23:00 UTC)