CFLAGS optimization

Jamie Jones hentai_yagi at yahoo.com.au
Sun Jan 8 14:49:50 GMT 2006


On Sun, 2006-01-08 at 08:45 -0400, rclbelem at gmail.com wrote:
> Hello people,
> 
> I'm packaging a software that need at last a athlon-xp or pentium4 to
> run. Which cflags may I add?

What is this software - it may be appropriate to have a foo and a
foo-i686 package. Using cflags to force a minimum arch isn't a good
idea, someone may actually try running your software on a lower spec
system.

If you want to tune your software, I'd suggest the following cflags, as
they usually provide a measurable speed increase, but don't restrict to
a particular arch.

"-O2 -fweb -fomit-frame-pointer -ftracer -fgcse-after-reload
-funswitch-loops"

Depending on the code "-ffast-math" may be a win too, but it is no
longer ieee compatible (read it has different results from what may be
expected)

If you need to schedule instructions, "-mtune=i686" will tune the
instructions for an i686 class processor, but still run on older
systems. More modern systems eg athlon, pentium3 will actually reorder
the instructions at run time to get the best benefit they can from the
code anyway, so it is hard to find an application that justifies
"-march=your_cpu_here"

No -mtune flags are needed for the amd64 arch, as by default it builds
-march=k8 as that is the basic instruction set.

Regards,
Yagisan
-- 
Jamie Jones
Proprietor
E-Yagi Consulting
ABN: 32 138 593 410
Mob: +61 4 16 025 081
Email: eyagi.consulting at gmail.com
Web: http://www.eyagiconsulting.com

GPG/PGP signed mail preferred. No HTML mail. No MS Word attachments
PGP Key ID 0x4B6E7209
Fingerprint E1FD 9D7E 6BB4 1BD4 AEB9 3091 0027 CEFA 4B6E 7209
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ubuntu.com/archives/ubuntu-motu/attachments/20060109/522fe67d/attachment.pgp


More information about the Ubuntu-motu mailing list