I was reading the Linux/arch/tile/lib/strlen_32.c
to know about the accomplishment of the strlen_32
. However I met two macro
s named __insn_seqb
and __insn_ctz
which I didn't know the meaning. The function strlen_32
is below:
size_t strlen(const char*s)
{
const uintptr_t s_int = (uintptr_t)s;
const uint32_t *p = (const uint32_t*)(s_int&-4);
uint32_t v = *p | ((1<<(s_int<<3))-1);
uint32_t bits;
while((bits=__insn_seqb(v,0))==0)
v = *++p;
return ((const char*)p)+(__insn_ctz(bits)>>3)-s;
}
I searched them on Google, but only found another macro definition:
#define CFZ(x) __insn_ctz(x)
in string_endian.h
glib-ports string-endian.h
Could someone tell me where the clear definition is or the real meaning and usage of these two macros?
They seem to be instruction intrinsics for Tilera processors.
I would guess that __insn_ctz
is a "count trailing zeroes" instruction.
__insn_seqb
seems to be testing for a 0 byte within a 4 byte word.
The Tilera instruction is apparently somewhat similar to MIPS.