svn commit: trunk/uClibc: include libc/string libc/string/generic etc...

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Tue Jul 21 22:26:42 UTC 2009


On Tue, Jul 21, 2009 at 03:36:03PM +0200, Denys Vlasenko wrote:
>On Tue, Jul 21, 2009 at 4:01 AM, Mike Frysinger<vapier at gentoo.org> wrote:
>>> Please try attached patch. For me it compiles. Resulting code
>>> from memchr(buffer, '\n', pending):
>>
>> fixes building for me, but please unify the branches before committing
>
>Sorry. What does it mean "unify the branches"?

Only one insn changed between OPTIMIZE, i.e. please just (if i read this correctly):

index cf4333d..198e1fe 100644
--- a/libc/string/i386/string.h
+++ b/libc/string/i386/string.h
@@ -288,32 +288,13 @@ void *inlined_memchr(const void *s, int c, size_t count)
 static __always_inline
 void *inlined_memchr_const_c(const void *s, int c, size_t count)
 {
-#if defined __OPTIMIZE__
 	void *edi;
 	int ecx, eax;
 	__asm__ __volatile__(
 		"	jecxz	1f\n"
+#if defined __OPTIMIZE__
 		"	movb	%4, %%al\n" /* const c to %%al */
-		"	repne; scasb\n"
-		"	leal	-1(%%edi), %%edi\n"
-		"	je	2f\n"
-		"1:\n"
-		"	xorl	%%edi, %%edi\n"
-		"2:\n"
-		: "=&D" (edi), "=&c" (ecx), "=&a" (eax)
-		: "0" (s), "i" (c), "1" (count)
-		/* : no clobbers */
-	);
-	return edi;
-#else
-	/* With -O0, gcc can't figure out how to encode CONST c
-	 * as an immediate operand. Generating slightly bigger code
-	 * (usually "movl CONST,%eax", 3 bytes bigger than needed):
-	 */
-	void *edi;
-	int ecx, eax;
-	__asm__ __volatile__(
-		"	jecxz	1f\n"
+#endif
 		"	repne; scasb\n"
 		"	leal	-1(%%edi), %%edi\n"
 		"	je	2f\n"
@@ -325,7 +306,6 @@ void *inlined_memchr_const_c(const void *s, int c, size_t count)
 		/* : no clobbers */
 	);
 	return edi;
-#endif
 }
 #if 1 /* +2 bytes on shared i386 build with gcc 4.3.0 */
 #define memchr(s, c, count) ( \

>--
>vda


More information about the uClibc mailing list