Message-ID: <3E29919E.B202D5DD@yahoo.com> Date: Sat, 18 Jan 2003 12:40:46 -0500 From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: gcc 3.2.1 optimizer degradation (strlen, -O2) 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> <2 DOT 7 DOT 9 DOT 2 DOT H8WXRK AT pauzner DOT dnttm DOT ru> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Leonid Pauzner wrote: > 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: I tried the following and got no hangs, but nothing seems to cause the very simple inline string instructions to be used. Running on a 486, gcc 3.2.1. I am surprised, because I found earlier that memcpy() does use them. /* Compile with -Wa,-alhn=strlgh.s to show code generated */ /* also try -minline-all-stringops */ #include #include char *s = "This is a string"; int main(int argc, char *argv[]) { int lgh; lgh = strlen(s); printf("%d %s\n", lgh, s); if (argc) while (--argc) { lgh = strlen(argv[argc]); printf("%d %s\n", lgh, argv[argc]); } return 0; } -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net) Available for consulting/temporary embedded and systems. USE worldnet address!