[PATCH v3 2/3] string: simplify find_zero_ne_all
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Mon Aug 17 11:50:28 GMT 2026
Hi Matt,
> Build the mask from the raw difference, as find_ne_all () now does.
> index_first () and index_last () only need to know which byte holds the
> first or the last set bit, and find_zero_all () marks only the bytes that
> were zero, so each term of the or marks only its own bytes.
>
> That drops one of the two carry chains from strcmp () and strncmp () on
> targets using the generic string-fza.h, and one of the two uqsub8 on
> armv6t2. As in find_ne_all (), only the generic implementation tests
> HAVE_BITOPTS_WORKING.
>
> powerpc keeps its existing form, where orc folds the complement of cmpb
> into the or and the raw difference saves nothing. alpha and riscv do not
> reach this code with the generic index_first ().
LGTM
Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
Cheers,
Wilco
More information about the Libc-alpha
mailing list