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: x86 code generation question


On Thu, Apr 29, 2004 at 04:38:34PM -0700, Zack Weinberg wrote:
> It should be noted that the code generated by gcc at -O0 is very very
> bad in general.  This might change in the future, but for the time
> being, we basically aren't interested in reports that the code
> generated at -O0 is lame.

I would be interested in having it the -O0 code be better only if the
changes would make gcc -O0 run faster, not slower.  Cheap changes to
reduce code size might qualify (since the assembler and linker run faster
if they have less code to deal with), but only if they are low effort.
The only real requirement is that debug be surprise-free (meaning that the
state of the world is as expected at each point where gdb can stop at a
breakpoint or stepping through lines).

However, changes at -O0 to eliminate conditional branching should be
*avoided* (or there should be a way to prevent them from happening), as it
can interfere with coverage measurements.  For example, given

    if (ax < bx)
       cx++;

we can produce something like

	cmpl %eax,%ebx
	sbb  %edx,%edx	; dx is 0 if ax >= bx, -1 if ax < bx
	subl %edx,%ecx

but now gcov can't tell if the conditional is ever true or ever false.


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