To: eliz AT is DOT elta DOT co DOT il Cc: gcc AT gcc DOT gnu DOT org, djgpp-workers AT delorie DOT com References: <2 DOT 7 DOT 9 DOT 181SX DOT H8JVM1 AT pauzner DOT dnttm DOT ru> <2561-Sat11Jan2003175230+0200-eliz AT is DOT elta DOT co DOT il> Message-Id: <2.7.9.2.H8WXRK@pauzner.dnttm.ru> From: "Leonid Pauzner" Date: Sat, 18 Jan 2003 17:04:32 +0300 (MSK) X-Mailer: dMail [Demos Mail for DOS v2.7.9] Subject: Re: gcc 3.2.1 optimizer degradation (strlen, -O2) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=====_dMail_2.7.9.1YSQ6.H8WXRJ_pauzner.dnttm.ru===_" Reply-To: djgpp-workers AT delorie DOT com This is a message in MIME format. Your mail reader does not support MIME :( --=====_dMail_2.7.9.1YSQ6.H8WXRJ_pauzner.dnttm.ru===_ Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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. --=====_dMail_2.7.9.1YSQ6.H8WXRJ_pauzner.dnttm.ru===_ Content-Type: application/octet-stream; name=len321.zip Content-Transfer-Encoding: x-uuencode Content-Disposition: attachment; filename=len321.zip begin 777 len321.zip M4$L#!!0````(``N",BZ"WU%'.P```&0````'````;U`?4=.DM*`E#!&J\^5Z..T3QWNET9%MQ&00I9PM MA&RGN2-LC=5"#LFXXXPS(YYTLVY:/9$,6B6-13LV&I%#(6('H$ M3D%9(@L]`#3964MDA5_]`X%!"2<5OH8X-N$W^GEFY2/.WO[@!U!+`P04```` M"``,=3(N*^*+>WH```"E````"0```'-T122.S4"(,)E24+R[B5VY>KR_[\`YI/5..!<5SLLQ7JRQIO"+KEI5 M)5%VX9F+(L2;H*N1M^9M#2"T<%$2_/6843=3PP#\@*O)C-$WVSZZ2L8X-;M% M3 AT 37E;[WTT[\M64X#3OCTS!?4$L#!!0````(`!MU,BY+'H8Z5P```&$````) M````<4E"LD9B44*6D`A35ZN:EXN!86BU)+2HCR%^/BDTLR*AR MD!)K7JY:D$D`4$L#!!0````(`"&",BX''KPET0```&(!```(````/!M^5JPI;4.KX?'M`M'(I=G] M,K.=7<+N7``)C.T%2%8'OD>8@=IR)2FS,%@$.BT%;R7=Q7&R]SW6"E4)>IM, MOC<7)R?5+_,09`V5=LV@>JS+(:;X.M*I-Q*CD8R:D1Q"["*$#MW#7HHWS])DQS7+F(0F*_WY9K):92]AYLN;E[P!^6X)H8EI(72]-$U=@8QH MDO5.R(1K8A#ZF>S)B8>N4X]U)4_D-8FWZU1=_11CEH9+_""X0QURL_J%ZWGM M!)^9?/HO)C$P*9I"GEON=@S-/YDI AT T^>ZFH:QJN#AI:' MV76FC*PS[+#9:T25H M#OO]*-K#R^M.#+*7*N_U&U!+`P04````"``B AT C(NB80^&T0!``#;`@``"0`` M`'-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