Pentium instructions with gcc?
wezy726
wezy726@email.msn.com
Sun Mar 11 05:52:00 GMT 2001
Here's what I've done... (Not that I
am an expert; I'd love to hear from someone with real info)
`gcc -v` This gives the path of the spec file the compiler is using.
ÃÂ ÃÂ ÃÂ In spec, there is a line, "*cpp_cpu_default:", which
declares the default definitions if no architecture orÃÂ CPU options are
specified.ÃÂ Initially, mine read something like "-D__tune_i386__".ÃÂ I
am using a Pentium III, so this was unsatisfactory.
ÃÂ ÃÂ ÃÂ The next section in specs, "*cpp_cpu:", is where the the
'-march' and '-mcpu' options are declared as cpp definitions.ÃÂ As best as I
can figure, "%{march=XXX: YYY" means "if -march=XXX option is given, then
YYY."ÃÂ Similarly, "%{!mcpu*: ZZZ" means "if noÃÂ -mcpu option is given,
then ZZZ."ÃÂ This section makes constructs like "If -march=i486 is given
with no -mcpu option, then '-D__i486 -D__i486__ -D__tune_i486__',"ÃÂ along
with making declarations for individualÃÂ CPUs and, finally, if no
architecture orÃÂ CPUÃÂ is specified, 'cpp_cpu_default' is defined.
ÃÂ ÃÂ ÃÂ After that, "*cc1_cpu:" declares CPU options to be given
to the compiler proper (I believe the above go to the preprocessor) using the
same syntax.
ÃÂ ÃÂ ÃÂ Since I'm using a Pentium III, I read through 'cpp_cpu' to
see what "-march=i686 -mcpu=i686" would become after preprocessing (turns out to
be equivalent to "pentiumpro" options).ÃÂ I then made that
'cpp_cpu_default'.
i.e.
*cpp_cpu_default:
-D__pentiumpro -D__pentiumpro__ -D__tune_pentiumpro__
I also added '-mcpu=i686' to 'cc1_cpu'ÃÂ in the "if no CPUs specified"
clause after all the other checks.ÃÂ I don't have any benchmarks, but
nothing breaks that didn't break before so I can't complain.
ÃÂ ÃÂ ÃÂ I haven't yet tweaked the "-Acpu(*) -Amachine(*)"
declarations in 'cpp_cpu', so I don't know if further optimization can be
performed there.ÃÂ I also don't know if `cc1` distinguishes between
'-mcpu=i686' and '-mcpu=pentiumpro' as `cpp` does.
ÃÂ
Britton E. Payne
"Work like you don't need the money; Love like you've never been hurt; Dance
like nobody is watching"ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ -- Keller
Williams
More information about the Gcc-help
mailing list