From owner-freebsd-questions@FreeBSD.ORG Fri Aug 18 18:01:07 2006 Return-Path: X-Original-To: freebsd-questions@FreeBSD.ORG Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EEB7716A4DA for ; Fri, 18 Aug 2006 18:01:07 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5035143D5A for ; Fri, 18 Aug 2006 18:01:02 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (xabufw@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id k7II0tKb072159; Fri, 18 Aug 2006 20:01:01 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id k7II0tIg072158; Fri, 18 Aug 2006 20:00:55 +0200 (CEST) (envelope-from olli) Date: Fri, 18 Aug 2006 20:00:55 +0200 (CEST) Message-Id: <200608181800.k7II0tIg072158@lurza.secnetix.de> From: Oliver Fromme To: freebsd-questions@FreeBSD.ORG, sigma_zk@yahoo.com In-Reply-To: <20060818161057.60674.qmail@web52309.mail.yahoo.com> X-Newsgroups: list.freebsd-questions User-Agent: tin/1.8.0-20051224 ("Ronay") (UNIX) (FreeBSD/4.11-STABLE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Fri, 18 Aug 2006 20:01:01 +0200 (CEST) Cc: Subject: Re: GCC - Optimal Optimization X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-questions@FreeBSD.ORG, sigma_zk@yahoo.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Aug 2006 18:01:08 -0000 Sean M. wrote: > With GCC 3.4.4, what are the best CFLAGS to use for an AMD Duron ~1000 > MHz? By "best" I mean creating the fastest programs that exploit fully > all of the architecture's features, without creating a "noticible" > increase in size. To date I've been using > CFLAGS="-O3 -march=athlon-xp -mfp-math=sse -funroll-loops -pipe > -ffast-math" I recommend staying with the default, i.e. not overriding CFLAGS at all, unless you know exactly what you're doing, for each single option. From your options above I notice that you don't know what you're doing. :-) The default is "-O2 -fno-strict-aliasing -pipe". If you specify any optimization level greater than -O (i.e. -O2 or -O3), you _must_ also include -fno-strict-aliasing, otherwise you will get broken code for certain programs. By the way, -funroll-loops can make programs slower, because the central parts might not fit into the CPU cache anymore. In many cases, the loop overhead is less significant than the overhead of having to access main memory. It depends on the program, of course -- there is no "one size fits all". Different programs will benefit from different optimizer flags. In general, the differences are small enough that it's not worth spending much time and efforts for benchmarking. That's another reason to recommend to just go with the default settings. You said you don't want an increase in size. But that's exactly what -O3 (via inlining) and -funroll-loops do. If you want not to increase size, use the default flags. You could even use -Os, which instructs the compiler to optimize for small size (it's somewhere between -O and -O2). Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "We, the unwilling, led by the unknowing, are doing the impossible for the ungrateful. We have done so much, for so long, with so little, we are now qualified to do anything with nothing."         -- Mother Teresa