Open davidbolvansky opened 2 years ago
Yeah, kinda tricky, but...
but still SIMD impl. could be possible? https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/memchr.S;hb=HEAD#l29
We have custom expander for SystemZ: https://github.com/llvm/llvm-project/blob/a33e4c8ae925e99e565b2ca5dcda8ec2edbb78ee/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp#L177
And isn't memcmp same story and still we have SIMD version of memcmp .. ?
I'm not certain when we can read beyond the first match in general terms. If we know the dereferencable range (not just the memchr count arg), we might be able to do more.
And isn't memcmp same story and still we have SIMD version of memcmp .. ?
From my reading of memchr's definition it says memchr must stop reading at first match, but any memcmp read within range is permitted.
https://en.cppreference.com/w/c/string/byte/memchr https://en.cppreference.com/w/c/string/byte/memcmp
Extended Description
Better to use SIMD than libcall for some reasonable N?