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]

Re: gcc 3.2.1 optimizer degradation (strlen, -O2)


11-Jan-2003 17:52 Eli Zaretskii wrote:
>> From: "Leonid Pauzner" <uue@pauzner.dnttm.ru>
>> Date: Sat, 11 Jan 2003 15:49:13 +0300 (MSK)
>>
>> It turns out that the libc strlen() function (compiled with -O2)
>> became nearly 2 times slower when I switched from gcc 2.95.3 to gcc 3.2.1
>> on a Pentium machine.

> Are you sure you get the library strlen?  IIRC, GCC provides its own
> inline versions of some functions, and I think strlen is one of them.

> Examining the code (use the -S switch to GCC to produce it) should
> show you whether my guess was true.

Sure, there is a "call _strlen" line in the assembler code,
and I made the test program by calling
  "gcc -o strlen.exe main.o strlen.o"

This is a DJGPP environment.

The key point in my original posting was the certain simple loop
which happens to be optimized better with the old version of the compiler.
Generated assembler attached.

> You could use the -fno-builtin switch to force GCC to call the
> (non-inline) library version of strlen.

Attachment: strlen.zip
Description: C sourses and generated assembler


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]