This is the mail archive of the gcc-help@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]

RE: Pentium instructions with gcc?


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


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