From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8012 invoked by alias); 30 Dec 2012 09:51:04 -0000 Received: (qmail 8003 invoked by uid 22791); 30 Dec 2012 09:51:03 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ee0-f54.google.com (HELO mail-ee0-f54.google.com) (74.125.83.54) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Dec 2012 09:50:55 +0000 Received: by mail-ee0-f54.google.com with SMTP id c13so5677816eek.27 for ; Sun, 30 Dec 2012 01:50:54 -0800 (PST) X-Received: by 10.14.219.3 with SMTP id l3mr101602163eep.5.1356861054385; Sun, 30 Dec 2012 01:50:54 -0800 (PST) Received: from kicer.localnet (095160139237.rudaslaska.vectranet.pl. [95.160.139.237]) by mx.google.com with ESMTPS id f6sm77782539eeo.7.2012.12.30.01.50.53 (version=SSLv3 cipher=OTHER); Sun, 30 Dec 2012 01:50:53 -0800 (PST) From: Kicer To: =?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?= Cc: David Brown , Andrew Haley , gcc-help@gcc.gnu.org Subject: Re: problems with optimisation Date: Sun, 30 Dec 2012 09:51:00 -0000 Message-ID: <1755562.0KhOMtMay3@kicer> User-Agent: KMail/4.8.5 (Linux/3.6.5-desktop-1.mga3; KDE/4.8.5; x86_64; ; ) In-Reply-To: <50DF6E0F.5090707@gmail.com> References: <3594412.lfrBexjLtS@kicer> <50DF19A5.2020909@westcontrol.com> <50DF6E0F.5090707@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg00152.txt.bz2 =C3=81ngel Gonz=C3=A1lez wrote: >=20 > I got good results (code apparently better) using -O3 in avr instead of > -Os. Just the skipped instructions in the prologue and epiloques may be > worth it. It may that since on avr you have one cycle per instruction > (except branches), when optimizing for speed, you indirectly also > optimize the number of instructions. However, I was using C, not C++, so > the different way of coding could lead to worse optimizations. > I recommend giving gcc as much information as possible, and watch the > generated code. I got gcc to perform a few tricky optimizations, and in > one case, I manually unrolled a loop for him (otherwise, it didn't > notice it could be optimized). If you see a very bad instance of code > generation, open a bug. :) > What difference do you have from -Os to -O3 ? Very often I also prefer O3 over Os, but this time Os seems to generate bet= er=20 results. That's probably because I leart how to program on avr using c++ (templates= =20 rules ;) ) and my program is almost always perfectly optimized. Only someti= mes=20 I get some weird behaviour when code becomes bigger. regards --=20 Micha=C5=82 Walenciak gmail.com kicer86 http://kicer.sileman.net.pl gg: 3729519