[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Compiling with -mtune?



On Thu, 2008-05-22 at 01:12 -0400, Felipe Sateler wrote:
> Hi. Csound, a package I maintain, supports enabling a set of gcc optimizations
> via a build option. Code generated with those options can be significantly
> faster (I've seen improvements of over 2x). However, this option means adding
> a -mtune option to gcc. Obviously, the only sane option for a debian package
> is -mtune=generic (which is apparently only available on x86 and amd64).
> However I read in the info pages for gcc:
> 
> > Produce code optimized for the most common IA32/AMD64/EM64T processors.
> 
> Does this mean that setting -mtune=generic is the same as setting -mtune to the
> most popular processor? If so, can/should I use that option?

Only for the supported architectures or you'll get a build failure on
ARM, powerpc, mips, sparc etc.

To check the arch, always test against the HOST architecture. Native
builds set HOST == BUILD but if the package is ever cross-built, your
debian/rules must allow building an ARM package on amd64 (HOST=ARM,
BUILD=amd64) and *NOT* enable -mtune.

DEB_HOST_ARCH_CPU=... -qDEB_HOST_ARCH_CPU)

This holds true for any architecture-specific checks in any package -
always, always check the HOST value - BUILD is almost always the wrong
variable to use.

-- 
Neil Williams <codehelp@debian.org>


Reply to: