Re: Release Building and /etc/make.conf

From: Bruce Evans <bde_at_zeta.org.au>
Date: Wed, 21 Jan 2004 01:41:26 +1100 (EST)
On Mon, 19 Jan 2004, Ruslan Ermilov wrote:

> On Mon, Jan 19, 2004 at 06:23:30PM +1100, Chris Knight wrote:
> > Howdy,
> >
> > I'm just doing a release build of 5.2 and have noticed that
> > from Stage 4.2 onwards, -mcpu=pentiumpro is added to the cc
> > command line.
> > The only place I can see this being set is in /etc/make.conf
> > which is outside the sandbox.
> > I was expecting the release build to be CPU agnostic, but
> > this doesn't appear to be the case. Any way of overriding
> > this without modifying /etc/make.conf?

Is there a problem with modifying /etc/make.conf?   As maxim said,
you can avoid /etc/make.conf using __MAKE_CONF.  You can also set
CPUTYPE in the environment.  Beware that settings in the enviroment
might not have precedence over settings in /etc/make.conf.  Anyway,
-mcpu=pentiumpro is not actually set in /etc/make.conf.  As ru doesn't
quite say, it is set in bsd.cpu.mk:

> There's a substantional difference between -mcpu and -march:
>
> : -mcpu=cpu type
> :        Assume  the defaults for the machine type CPU TYPE when schedul-
> :        ing instructions.  The choices for CPU  TYPE  are:  i386,  i486,
> :        i586  (pentium),  pentium,  i686  (pentiumpro),  and pentiumpro.
> :        While picking a specific CPU TYPE will schedule things appropri-
> :        ately  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.
> :
> : -march=cpu type
> :        Generate instructions for the machine type CPU TYPE.  The choic-
> :        es for CPU TYPE are: i386, i486, pentium, and pentiumpro.  Spec-
> :        ifying -march=cpu type implies -mcpu=cpu type.
>
> Please also see the commit log for bsd.cpu.mk,v 1.13.

Also see gcc.info, since the above seems to be from gcc.1 which is as out
of date as a pentiumpro.

bsd.cpu.mk should rarely be edited, but /etc.make.conf is per-machine so
you can put anything you want in it.  However, defaulting to
-mcpu=pentiumpro is just a bug, so I edit it out of bsd.cpu.mk.  It
just micro-pessimizes for all CPUs that aren't pentium pros.  This is
almost harmless for i386's because no one uses them, and almost harmless
for P3's and maybe P4's because they share some bottlenecks with pentiumpros,
but Athlons handle naive i386 code better than pentiums so many of the
pentiumpro optimizations are pessimizations for athlons.

Note that CPUTYPE has worse bugs for i386's.  Setting it to a supported
CPU gives -march instead of -mcpu, so using it gives unportable binaries,
and bsd.cpu.mk provides no way to get the corresponding -mcpu settings.
OTOH, CPUTYPE for alphas gives only -mcpu.

Some times for an integer crunching application (searching a game tree)
compiled with various options and running on an Athlon-XP:

-O3 -fomit-frame-pointer -mcpu=i586:        11.21 seconds
-O3 -fomit-frame-pointer -mcpu=athlon-xp:   11.23
-O3 -fomit-frame-pointer -mcpu=i386:        11.93 (-mcpu=i386 is the default)
-O3 -fomit-frame-pointer -mcpu=i486         12.72
-O3 -fomit-frame-pointer -mcpu=pentium3:    14.71
-O3 -fomit-frame-pointer -mcpu=pentium-pro  14.72
-O3 -fomit-frame-pointer -mcpu=pentium2:    14.72
-O3 -fomit-frame-pointer -mcpu=pentium4:    18.19

I think my normal application (cc) is not affected by -mcpu nearly as much
as this, and don't use -mcpu for building worlds.  The above shows that
-mcpu=i386 is not too bad for athlons (but this might change for FP
crunching applications).

Bruce
Received on Tue Jan 20 2004 - 05:42:18 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:39 UTC