Subject: a new C compiler optimizing for Pentium/AMD

From: Eugene Leitl <[email-masked]>
Date: Tue, 16 Mar 1999 12:48:02 +0100 (CET)

ftp://ftp.goof.com/pub/pcg/source/
http://www.goof.com/pcg/pgcc-faq.html

1.5 What is PGCC?
PGCC stands for Pentium GCC. The PGCC is a version of the GNU C 
compiler (gcc), which provides special optimizations for the Pentium 
processor. 
[...]

2.3 Can I compile the Linux kernel with PGCC?
Of course! Kernels 2.1.50 and later should compile without 
any problems. Older kernels will not work - see the next 
question for details.
[...]

2.5 Does PGCC support Pentium-compabible CPUs?
Yes. PGCC's generic Pentium optimised code will run on the Pentium 
clones as well as Intel chips. There is a specially tuned optimization 
mode for AMD K6 chips. 
Code which contains Pentium Pro instructions (ie, has been compiled
with -march=pentiumpro) will only work on those CPUs which support 
those instructions. Currently, that means at least the Pentium Pro
(obviously), Pentium II, Celeron and the Cyrix M2. The AMD K6 does 
not support them.

2.6 Does PGCC support MMX or 3Dnow! instructions?
PGCC does support MMX and 3Dnow! - recent snapshots can generate MMX 
instructions, and you can include them both in inline assembly. Using 
inline assembler will almost certainly produce the best results.
To use these instructions, you need to be using GNU binutils-2.9.1 
or later. For full details, see the optimization section.
[...]

4.2 How do I tell the compiler which CPU I'm using?
The options controlling processor type come in two forms. You can
enable scheduling for a given processor using -mcpu. This will produce 
binaries which will run on any Intel CPU, but which should perform best for
the CPU type. For those CPUs where PGCC knows about additional
instructions, you can use -march=cpu. Binaries compiled with -march
may not run on other kinds of CPU. 
Currently, cpu can be chosen from 486, pentium, pentiumpro and either 
amdk6 (in released versions) or k6 (in snapshots). There is no
specific Pentium II support, but it is very much like a Pentium Pro
and so Pentium Pro options tend to work best. Please note when when 
using -march that the resulting binaries will only run on CPUs which 
support the same instruction set as the architecture selected. See the 
compatbility section for some details.

4.3 Can PGCC use the MMX features of my CPU?
Recent snapshots support MMX so long as you are using binutils-2.9.1 
or later. You can include MMX instructions in inline assemlber, or 
enable the compiler optimizations by using the -mmx option (use
-mmx-only if your code never uses the FPU). These optimizations are 
unlikely produce much improvement without special fine-tuning of the 
code to take advantage of them. 
This probably won't result in any improvement on Pentiums - their MMX 
unit is not particularly fast, so the code must be specially
structured to take advantage of the MMX. The implementation of MMX 
in the Pentium II is somewhat better, so more improvements may be seen 
there.

4.4 Is there 3Dnow! support? 
Currently, the only support for 3Dnow! is the ability to use it in 
inline assembly. As with MMX, you need binutils-2.9.1 or later to do
this.

Regards,
Eugene Leitl