Re: kernel + gcc 4.1 = several problems

From: Denis Vlasenko
Date: Sat Jan 06 2007 - 23:27:39 EST


On Thursday 04 January 2007 18:37, Linus Torvalds wrote:
> With 7+ million lines of C code and headers, I'm not interested in
> compilers that read the letter of the law. We don't want some really
> clever code generation that gets us .5% on some unrealistic load. We want
> good _solid_ code generation that does the obvious thing.
>
> Compiler writers seem to seldom even realize this. A lot of commercial
> code gets shipped with basically no optimizations at all (or with specific
> optimizations turned off), because people want to ship what they debug and
> work with.

I'd say "care about obvious, safe optimizations which we still not do".
I want this:

char v[4];
...
memcmp(v, "abcd", 4) == 0

compile to single cmpl on i386. This (gcc 4.1.1) is ridiculous:

.LC0:
.string "abcd"
.text
...
pushl $4
pushl $.LC0
pushl $v
call memcmp
addl $12, %esp
testl %eax, %eax

There are tons of examples where you can improve code generation.
--
vda
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/