This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Gcc builtin review: strstr, strcasestr, memmem
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Cc: Andrew Pinski <pinskia at gmail dot com>
- Date: Mon, 25 May 2015 21:09:23 +0200
- Subject: Gcc builtin review: strstr, strcasestr, memmem
- Authentication-results: sourceware.org; auth=none
- References: <20150525101505 dot GA11233 at domone> <20150525114545 dot GC11233 at domone>
A gcc does little optimizations, just constant arguments.
And why gcc doesnt optimize memmem as arguments are constant and with
size 1 needle it could use memchr?
#include <string.h>
int foo(char *x)
{
return memmem ("tauhtatu", 4, "f", 1);
}