Subject: Re: default optimization
To: SAITOH Masanobu <masanobu@iij.ad.jp>
From: Rafal Boni <rafal@mediaone.net>
List: port-i386
Date: 01/22/2001 17:11:28
In message <200101222130.f0MLU4X18720@h053n005.iij.ad.jp>, msaitoh@netbsd.org
wrote: 

->  Sorry, I had been misunderstanding.
-> 

[...-mcpu= description from gcc.info...]
->  >      While picking a specific CPU TYPE will schedule things
->  >      appropriately for that particular chip, the compiler will not
->  >                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
->  >      generate any code that does not run on the i386 without the
->  > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
->  >      `-march=CPU TYPE' option being used.  `i586' is equivalent to
->  >      `pentium' and `i686' is equivalent to `pentiumpro'.  `k6' is the
->  >      AMD chip as opposed to the Intel ones.

[...]
-> "gcc -Q -v tst.c" shows:
-> 
-> ------
->  /usr/libexec/cc1 /tmp/cclGvoqB.i -dumpbase tst.c -version -o /tmp/ccyPq5c4.
-> s
-> GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386-netbsd) compi
-> led by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
-> options passed: 
-> options enabled:  -fpeephole -ffunction-cse -fkeep-static-consts
->  -fpcc-struct-return -fsjlj-exceptions -fcommon -fgnu-linker
->  -fargument-alias -m80387 -mhard-float -mno-soft-float -mieee-fp
->  -mfp-ret-in-387 -mno-fancy-math-387 -mschedule-prologue -mcpu=i386
->  -march=pentium
-> ------
-> 
-> It seems our gcc defines both "-mcpu=i386" and "-march=pentium" by default.

Given that we expect things to run on any x86 processor down to the '386,
maybe the defaults should be '-mcpu=pentium -march=i386' by default, in
other words the opposite of what we do now.

This way, users could compile with '-mcpu=pentiumpro' and get PPro-tuned
binaries and still be able to run them on their boat-anchor 386 boxes.
Although for the most part this is all but an academic exercise (maybe
excepting the snapshot/release builders), it does violate the principle
of least astonishment.

[All this, of course, if only applicable if what gcc.info says is true 8-]

--rafal

----
Rafal Boni                                                  rafal@mediaone.net