All pastes #4840 Raw Edit

gcc inline asm problem

public cpp v1 · immutable
#4840 ·published 2005-01-27 14:48 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;\		sub $16, %%edx;\		"		: "=edx"(zts)		: "edx"(zts)	);    while (*zts++ != 0);    return zts - start - 1;}