This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
11-Jan-2003 23:33 Marcel Cox wrote: > 3) Except for Pentium4, GCC 3.2.1 does not inline the strlen function in > your code as it considers the gain to be not worthwhile. You can however > force it to do so anyway by using the option -minline-all-stringops and see > if that makes a difference. Apparently, gcc 3.2.1 __builtin_strlen() never inlined on Pentium 90MHz so the following function hangs: ====== strlen3.c ========= #include <string.h> size_t strlen(const char *str) { return __builtin_strlen(str); } ========================== gcc -O2 -S -c strlen3.c ====== strlen3.s ========= .file "strlen3.c" .section .text .p2align 4,,15 .globl _strlen _strlen: pushl %ebp movl %esp, %ebp popl %ebp jmp _strlen .ident "GCC: (GNU) 3.2.1" ========================== Update my previous tests: >> 2.95 do inline strlen(), while 3.2.1 is not. >> Nevertheless I got the following results in my test: >> >> gcc321 -O2 >> strlen.c 20 sec >> strlen2.c 17 sec strlen3.c hangs! >> (library) 14 sec (yes, libc compiled with other gcc version/flags) strlen3.c 8 sec (-O2 -minline-all-stringops) (builtin) 7 sec (main.c was compiled with -O2 -minline-all-stringops) >> >> gcc295 -O2 >> strlen.c 16 sec (main.c was compiled without -O) >> strlen2.c 11 sec (main.c was compiled without -O) strlen3.c 9 sec (main.c was compiled without -O) >> (builtin) 8 sec GCC 321 assembler for the above functions attached.
Attachment:
len321.zip
Description: Binary data
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |