public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Barak A. Pearlmutter" <barak@cs.nuim.ie>
To: gcc-help@gcc.gnu.org
Subject: Re: Bizarrely Poor Code from Bizarre Machine-Generated C Sources
Date: Tue, 29 May 2007 16:10:00 -0000	[thread overview]
Message-ID: <E1Ht4DN-000179-4e@localhost> (raw)
In-Reply-To: "barak@cs.nuim.ie"'s message of 27 May 2007 15:05:37 +0100

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 <barak@cs.nuim.ie>
 Hamilton Institute & Dept Comp Sci, NUI Maynooth, Co. Kildare, Ireland
 http://www.bcl.hamilton.ie/~barak/

             reply	other threads:[~2007-05-29 16:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-29 16:10 Barak A. Pearlmutter [this message]
2007-05-29 23:39 ` Andrew Haley
  -- strict thread matches above, loose matches on Subject: below --
2007-05-27 15:11 Barak A. Pearlmutter
2007-05-27 18:22 ` Rask Ingemann Lambertsen
2007-05-28  7:23   ` Barak A. Pearlmutter
2007-05-28  9:42     ` Mattias Engdegård
2007-05-28 11:26     ` Rask Ingemann Lambertsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1Ht4DN-000179-4e@localhost \
    --to=barak@cs.nuim.ie \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).