Optimizing for a Target Machine or Class of Machines

Target machine options are options that instruct the compiler to generate code for optimal execution on a given processor or architecture family. By default, the compiler generates code that runs on all supported systems, but perhaps suboptimally on a given system. By selecting appropriate target machine options, you can optimize your application to suit the broadest possible selection of target processors, a range of processors within a given family, or a specific processor. The following compiler options control optimizations affecting individual aspects of the target machine.

Target machine options
Option Behavior
-q32 Generates code for a 32-bit addressing model (32-bit execution mode).
-q64 Generates code for a 64-bit addressing model (64-bit execution mode).
-qarch Selects a family of processor architectures, or a specific architecture, for which instruction code should be generated.
-qtune Biases optimization toward execution on a given processor, without implying anything about the instruction set architecture to use as a target.
-qcache Defines a specific cache or memory geometry. The defaults are set through -qtune.

Selecting a predefined optimization level sets default values for these individual options.

Related Information:
See -qarch Option, -qtune Option, and -qcache Option.

Getting the Most out of Target Machine Options

Try to specify with -qarch the smallest family of machines possible that will be expected to run your code reasonably well.

Try to specify with -qtune the machine where performance should be best. If you are not sure, let the compiler determine how to best tune for optimization for a given -qarch setting.

Before using the -qcache option, look at the options sections of the listing using -qlist to see if the current settings are satisfactory. The settings appear in the listing itself when the -qlistopt option is specified. Modification of cache geometry may be useful in cases where the systems have configurable L2 or L3 cache options or where the execution mode reduces the effective size of a shared level of cache (for example, two-core-per-chip SMP execution on POWER4).

If you decide to use -qcache, use -qhot or -qsmp along with it.

Related Information:
IBM Copyright 2003