CPUTYPE considered harmful

Jeroen Ruigrok tried using ‘CPUTYPE=p4’ in make.conf as an option to gcc. The resulting kernel crashed; and several people pointed out that the CPUTYPE optimization does not work – especially with gcc 2.x. Matt Dillon went on further to explain how little it helps:

“Trying to use cpu-specific optimizations in 2.95.x is roughly equivalent to a blind man driving an 18 wheeler down the highway. In other words: “don’t do it, it doesn’t work”. GCC2 is known to produce bad code not only with CPUTYPE, but also with higher optimization levels like -O2. Blame the GCC folks for this.

GCC3 does a better job but even so I would not use CPUTYPE without being prepared to turn it off when something breaks, and at best I might use -O2 or -Os (under GCC3 only, and even then we don’t really officially support it, since differentiating between compiler code generation bugs and DFly bugs is extremely difficult).

Besides, you won’t notice any improvement in kernel performance.”

One Reply to “CPUTYPE considered harmful”

  1. Heheh. I’ve done this, despite the fact that I know better, and it worked every bit as well as I expected it to.

    All in all, it was about as purposeful an excercise as making a swapfile in a ramdisk.

Comments are closed.