The following table gives the details for each of the -xarch keywords on SPARC platforms.
Table A–23 The -xarch Flags for SPARC Platforms
Also note the following:
SPARC instruction set architectures V8 and V8a are binary compatible.
Object binary files (.o) compiled with v8plus and v8plusa can be linked and can execute together, but only on a SPARC V8plusa compatible platform.
Object binary files (.o) compiled with v8plus, v8plusa, and v8plusb can be linked and can execute together, but only on a SPARC V8plusb compatible platform.
-xarch values v9, v9a, and v9b are only available on UltraSPARC 64-bit Solaris operating systems.
Object binary files (.o) compiled with generic64, native64, v9 and v9a can be linked and can execute together, but will run only on a SPARC V9a compatible platform.
Object binary files (.o) compiled with generic64, native64, v9, v9a, and v9b can be linked and can execute together, but will run only on a SPARC V9b compatible platform.
For any particular choice, the generated executable may run much more slowly on earlier architectures. Also, although quad-precision (REAL*16 and long double) floating-point instructions are available in many of these instruction set architectures, the compiler does not use these instructions in the code it generates.
The following table lists the -xarch flags on x86 platforms.
Table A–24 The -xarch Flags on x86
Flag |
Meaning |
---|---|
amd64 |
Is equivalent to -m64 -xarch=sse2 (Solaris only). Legacy makefiles and scripts that use -xarch=amd64 to obtain the 64-bit memory model need only use -m64. |
amd64a |
Is equivalent to -m64 -xarch=sse2a (Solaris only). |
generic |
Uses the instruction set common to most processors. This is the default. |
generic64 |
Compile for good performance on most 64-bit platforms. (Solaris only). This option is equivalent to -m64 -xarch=generic and is provided for compatibility with earlier releases. Use -m64 to specify 64-bit compilation instead of -xarch=generic64. |
native |
Compile for good performance on this system. The compiler chooses the appropriate setting for the current system processor it is running on. |
native64 |
Compile for good performance on this system (Solaris only). This option is equivalent to -m64 -xarch=native and is provided for compatibility with earlier releases. |
pentium_pro |
Limits the instruction set to the 32–bit pentium_pro architecture. |
pentium_proa |
Adds the AMD extensions (3DNow!, 3DNow! extensions, and MMX extensions) to the 32-bit pentium_pro architecture. |
sse |
Adds the SSE instruction set to the pentium_pro architecture. |
ssea |
Adds the AMD extensions (3DNow!, 3DNow! extensions, and MMX extensions) to the 32-bit SSE architecture. |
sse2 |
Adds the SSE2 instruction set to the pentium_pro architecture. |
sse2a |
Adds the AMD extensions (3DNow!, 3DNow! extensions, and MMX extensions) to the 32-bit SSE2 architecture. |
sse3 |
Adds the SSE3 instruction set to SSE2 instruction set. |
There are some important issues to be aware of when compiling for x86 Solaris platforms.
The legacy Sun-style parallelization pragmas are not available on x86. Use OpenMP instead. See the Sun Studio 12: OpenMP API User’s Guide for information on converting legacy parallelization directives to OpenMP.
Programs compiled with -xarch set to sse, sse2, sse2a, or sse3 must be run only on platforms that provide these extensions and features.
OS releases starting with Solaris 9 4/04 are SSE/SSE2-enabled on Pentium 4-compatible platforms. Earlier versions of Solaris OS are not SSE/SSE2-enabled. If an instruction set selected by -xarch is not enabled in the running Solaris OS, the compiler will not be able to generate or link code for that instruction set.
If you compile and link in separate steps, always link using the compiler and using the same -xarch setting to ensure that the correct startup routine is linked.
Numerical results on x86 may differ from results on SPARC due to the x86 80-bit floating-point registers. To minimize these differences, use the -fstore option or compile with -xarch=sse2 if the hardware supports SSE2.
Numerical results can also differ between Solaris and Linux because the intrinsic math libraries (for example, sin(x)) are not the same.
Starting with Sun Studio 11 and the Solaris 10 OS, program binaries compiled and built using these specialized -xarch hardware flags are verified that they are being run on the appropriate platform.
On systems prior to Solaris 10, no verification is done and it is the user's responsibility to ensure objects built using these flags are deployed on suitable hardware.
Running programs compiled with these -xarch options on platforms that are not enabled with the appropriate features or instruction set extensions could result in segmentation faults or incorrect results occurring without any explicit warning messages.
This warning extends also to programs that employ .il inline assembly language functions or __asm() assembler code that utilize SSE, SSE2, SSE2a, and SSE3 instructions and extensions.
The default architecture for which the C++ compiler produces code is now v8plus (UltraSPARC). Support for v7 will be dropped in a future release.
The new default yields higher run-time performance for nearly all machines in current use. However, applications that are intended for deployment on pre-UltraSPARC computers no longer execute by default on those computers. Compile with -xarch=v8 to ensure that the applications execute on those computers.
If you want to deploy on v8 systems, you must specify the option -xarch=v8 explicitly on every compiler command line as well as any link-time commands. The provided system libraries run on v8 architectures.
If you want to deploy on v7 systems, you must specify the option -xarch=v7 explicitly on every compiler command line as well as any link-time commands. The provided system libraries use the v8 instruction set. For this release, the only supported operating system for v7 is the Solaris 8 OS release. When a v8 instruction is encountered, the Solaris 8 OS interprets the instruction in software. The program runs, but performance is degraded.
For x86, -xarch defaults to generic. Note that -fast on x86 expands to -xarch=native. This option limits the code generated by the compiler to the instructions of the specified instruction set architecture. This option does not guarantee use of any target–specific instructions. However, use of this option may affect the portability of a binary program.
Although this option can be used alone, it is part of the expansion of the -xtarget option and may be used to override the –xarch value that is set by a specific -xtarget option. For example, -xtarget=ultra2 expands to -xarch=v8plusa -xchip=ultra2 -xcache=16/32/1:512/64/1. In the following command -xarch=v8plusb overrides the -xarch=v8plusa that is set by the expansion of -xtarget=ultra2.
example% CC -xtarget=ultra2 -xarch=v8plusb foo.cc |
Use of –compat[=4] with -xarch=generic64, -xarch=native64, -xarch=v9, -xarch=v9a, or -xarch=v9b is not supported.
If you use this option with optimization, the appropriate choice can provide good performance of the executable on the specified architecture. An inappropriate choice, however, might result in serious degradation of performance or in a binary program that is not executable on the intended target platform.
If you compile and link in separate steps, make sure you specify the same value for -xarch in both steps.