Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Mar 2001 21:46:55 +0100
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Chris Dillon <cdillon@wolves.k12.mo.us>
Cc:        cvs-all@FreeBSD.ORG
Subject:   Re: -march considered harmful? (Re: cvs commit: src/etc/defaults make.conf)
Message-ID:  <20010308214655.A4559@student.uu.se>
In-Reply-To: <Pine.BSF.4.32.0103081314590.34818-100000@mail.wolves.k12.mo.us>; from cdillon@wolves.k12.mo.us on Thu, Mar 08, 2001 at 01:26:58PM -0600
References:  <20010308102441.B7727@daemon.ninth-circle.org> <Pine.BSF.4.32.0103081314590.34818-100000@mail.wolves.k12.mo.us>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Mar 08, 2001 at 01:26:58PM -0600, Chris Dillon wrote:

[snip]

> 
> Out of curiosity though, can -march=pentium optimizations actually
> _hurt_ performance on PentiumPro-and-above machines?  If I remember
> what I read correctly, Intel goofed on part of the P6 architecture and
> caused a partial register stall during what they actually recommended
> as an optimization for the P5 series CPUs in their optimization
> documents (duh?!).  I think this is one reason why many people said
> "legacy code may actually run slower on the Pentium Pro" when it came
> out.  I'm wondering if the same optimization is used by gcc.
> 

Theoretically yes, optimizing for Pentium might give suboptimal behviour on
later processors. I am not familiar enough with the processors or with the
code generated by gcc to say if this actually happens though. I do believe
that any such slowdown would be quite slow though. (The processors are
supposed to run fast on legacy code after all.)


> In the same vein, can -march=pentiumpro hurt performance for P5 class
> CPUs, or even cause the code not to work at all (unsupported
> instructions)?

If there were any new instructions introduced between P5 and P6 then code
compiled with -march=pentiumpro might use those instructions and thus not
work on older processors. If it works it might still hurt performance on
older processors. Again I don't know enough about the details to say if this
actually happens but it is not only possible but even plausible.

Basically if you compile with -march= you shouldn't run that code on
different processors. (-mcpu= can be used if you wish to optimize for a
certain processor while still retaining backwards compatibility.)

(If you compile with -march=pentiumpro I can almost guarantee that the 
generated code won't run on a '386 and most likely not on a '486 either.)

-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010308214655.A4559>