To completely specify the target architecture for which the compiler should generate optimized code, there are three option flags you can use:
-xarch=keyword choose the target instruction set by keyword
Examples: generic, native, sparc, sparcvis, sparcvis2, sparcfmaf, sparcima, 386, pentium_pro, sse, sse2, amd64, pentium_proa, ssea, sse2a, amd64a, sse3, ssse3
-xchip=keyword choose the target processor for optimization
Examples: generic, native, sparc64vi, sparc64vii, ultra, ultra2, ultra2e, ultra2i, ultra3, ultra3cu, ultra3i, ultra4, ultra4plus, ultraT1, ultraT2, core2, opteron, pentium, pentium_pro, pentium3, pentium4, nehalem
-xcache=spec choose the target processor's cache specifications
Examples: generic, native, level1spec:level2spec:level3spec
In all cases, generic compiles for the good performance on most platforms, and native compiles for the same platform the compiler is running on. Combine with -m32 and -m64 and you have a complete set of options for 32-bit and 64-bit target processors.
But knowing the right combination of options for your processor may be too much to deal with, so the compiler also provides a macro to set all three options to some standard values. This is the -xtarget=keyword option:
-xtarget=keyword choose the target processor to compile for
Examples: generic, native, ultra, ultra2, ultra2i, ultra 3, ultra3cu, ultra3ci, ultra4, ultra4plus, ultraT1, ultraT2, sparc64vi, sparc64vii, pentium, pentium_pro, pentium3, pentium4, woodcrest, penryn, nehalem, opteron, and others.
Each keyword expands into a unique -xarch/-xchip/-xcache setting, like:
-xtarget=ultra4 is equivalent to
-xarch=sparcvis -xcache=64/32/4:8192/128/2 -xchip=ultra4
-xtarget=woodcrest is equivalent to
-xarch=ssse3 -xcache=32/64/8:4096/64/16 -xchip=core2
Keep in mind that -fast (discussed in an earlier post) sets a number of reasonable optimization options, including -xtarget=native. For example, on my AMD64 Turion laptop:
>f95 -xtarget=native -dryrun ### command line files and options (expanded): ### -xarch=sse3a -xcache=64/64/2:1024/64/16 -xchip=opteron -dryrun
|
So if I compile on my laptop, but want to deploy the binary application on an Intel Woodcrest system, I would have to override the native target if I still want to use -fast:
>f95 -fast -xtarget=woodcrest -dryrun ### command line files and options (expanded): ### -xO5 -dalign -fsimple=2 -fns=yes -ftrap=common -xlibmil -xlibmopt -nofstore -xregs=frameptr -xarch=ssse3 -xcache=32/64/8:4096/64/16 -xchip=core2 -dryrun -xdepend=yes
|
What you can't do is cross-compile between SPARC and x86/x64 -- you can't compile on a SPARC system to generate code for an Intel or AMD platform, and v.v.
But knowing your target can be important.
(The details are in the compiler man pages)