All pastes #4841 Raw Edit

gcc mmx strlen

public cpp v1 · immutable
#4841 ·published 2005-01-27 15:00 UTC
rendered paste body
size_t scali_mmx_strlen(const char *zts) {    const char *start = zts;    unsigned int alignment = (unsigned int)zts & 7;    while(alignment--) if(!*zts++) return zts - 1 - start;    asm volatile("\		pxor %%mm0, %%mm0;\		pxor %%mm1, %%mm1;\		mmxloop:\		pcmpeqb (%%edx), %%mm0;\		pcmpeqb 8(%%edx), %%mm1;\		add $16, %%edx;\		por %%mm1, %%mm0;\		packsswb %%mm0, %%mm0;\		movd %%mm0, %%edx;\		pxor %%mm0, %%mm0;\		pxor %%mm1, %%mm1;\		test %%edx, %%edx;\		jz mmxloop;\		emms;\		sub $16, %%edx;\		"		: "=edx"(zts)		: "edx"(zts)	);    while (*zts++ != 0);    return zts - start - 1;}