[PATCH 04/17] Add string vectorized find and detection functions

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Sep 19 14:00:31 GMT 2022



On 03/09/22 00:20, Noah Goldstein wrote:
>> +
>> +/* With similar caveats, identify zero bytes in X1 and bytes that are
>> +   not equal between in X1 and X2.  */
>> +static inline op_t
>> +find_zero_ne_low (op_t x1, op_t x2)
>> +{
>> +  op_t m = ((op_t)-1 / 0xff) * 0x7f;
> 
> Can this use repeat_bytes?

We can, I will update it.

>> +  op_t eq = x1 ^ x2;
>> +  op_t nz1 = (x1 + m) | x1;    /* msb set if byte not zero.  */
>> +  op_t ne2 = (eq + m) | eq;    /* msb set if byte not equal.  */
>> +  return (ne2 | ~nz1) & ~m;    /* msb set if x1 zero or x2 not equal.  */
>> +}
>> +
>> +static inline op_t
>> +find_zero_ne_all (op_t x1, op_t x2)
>> +{
>> +  op_t m = ((op_t)-1 / 0xff) * 0x7f;
> 
> Likewise. Elsewhere too.

Ack.


More information about the Libc-alpha mailing list