From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21010 invoked by alias); 29 May 2007 16:06:59 -0000 Received: (qmail 20999 invoked by uid 22791); 29 May 2007 16:06:58 -0000 X-Spam-Check-By: sourceware.org Received: from mail.nuim.ie (HELO LARCH.MAY.IE) (149.157.1.19) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 May 2007 16:06:56 +0000 Received: from localhost ([149.157.192.252]) by NUIM.IE (PMDF V6.2-X17 #30789) with ESMTP id <01MH5Z1TFWZU000SVY@NUIM.IE> for gcc-help@gcc.gnu.org; Tue, 29 May 2007 17:07:10 +0000 (GMT) Received: from barak by localhost with local (Exim 4.63) (envelope-from ) id 1Ht4DN-000179-4e; Tue, 29 May 2007 17:06:29 +0100 Date: Tue, 29 May 2007 16:10:00 -0000 From: "Barak A. Pearlmutter" Subject: Re: Bizarrely Poor Code from Bizarre Machine-Generated C Sources In-reply-to: "barak@cs.nuim.ie"'s message of 27 May 2007 15:05:37 +0100 To: gcc-help@gcc.gnu.org Reply-to: barak@cs.nuim.ie Message-id: Content-transfer-encoding: 7BIT References: 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: 2007-05/txt/msg00300.txt.bz2 Success! Some working magic seems to be this: gcc -s -o particle1 \ -O3 \ -march=k8 \ -mfpmath=sse \ -finline-limit=100000 \ --param large-function-insns=1000000 \ --param inline-unit-growth=1000000 \ --param sra-field-structure-ratio=0 \ particle1.c -lm although it looks like -Os gives an additional improvement. This (with GCC 4.1) reduces code volume to about 16k from a previous near 1M, and reduces runtime by a factor of about 2700, as compared to just -O3. Further improvements welcome. I'd also suggest adding a section to the GCC documentation on "how to use GCC as a back-end to another compiler" which gives some typical magic options like the above that would be useful in circumstances like these. -- Barak A. Pearlmutter Hamilton Institute & Dept Comp Sci, NUI Maynooth, Co. Kildare, Ireland http://www.bcl.hamilton.ie/~barak/