From owner-cvs-all Thu Mar 8 12:46:52 2001 Delivered-To: cvs-all@freebsd.org Received: from maile.telia.com (maile.telia.com [194.22.190.16]) by hub.freebsd.org (Postfix) with ESMTP id EBDAA37B71A for ; Thu, 8 Mar 2001 12:46:47 -0800 (PST) (envelope-from ertr1013@student.uu.se) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by maile.telia.com (8.11.2/8.11.0) with ESMTP id f28Kkks11371 for ; Thu, 8 Mar 2001 21:46:46 +0100 (CET) Received: from ertr1013.student.uu.se (h35n2fls20o913.telia.com [212.181.163.35]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id VAA04258 for ; Thu, 8 Mar 2001 21:46:43 +0100 (CET) Received: (qmail 4603 invoked by uid 1001); 8 Mar 2001 20:46:55 -0000 Date: Thu, 8 Mar 2001 21:46:55 +0100 From: Erik Trulsson To: Chris Dillon 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> Mail-Followup-To: Chris Dillon , cvs-all@FreeBSD.ORG References: <20010308102441.B7727@daemon.ninth-circle.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from cdillon@wolves.k12.mo.us on Thu, Mar 08, 2001 at 01:26:58PM -0600 Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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.) -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message