x86/x64 Compiler Backend Team Weblog

20060213 Monday February 13, 2006

News



This web page contains news/general info/technical tips for the x86/x64 common compiler backend in Sun Studio compiler C, C++ and Fortran and the x86/x64 assembler.

What's New in Studio11 from x86/x64 compiler backend?


Performance Records   (Sun Studio 11)

x86/64 Sun Studio 11 has achieved many performance records

Read the records from

 » Vijay Tatkar's -1/13/2006 blog

Hardware Capability Support  (Sun Studio 11)

In solaris 10, Hardware Capability checking is done by the presence of certain markings in the executable files(e.g. a.out).  The linker makes the marking according to the markings in the object (.o) files and library files.  X86/x64 Sun Studio 11 compilers(C, C++ and Fortran) and assembler now by defualt produce such markings in the .o files, according to the instructions that has been generated in them.


To learn more about Hardware Capability marking and how to turn it off, read the following article:
 » Alfred Huang's blog on Jan 13, 2006 - "Ridding or modifying hardware capabilities info

Media Intrinsic functions (Sun Studio 11)

There are many lower level SSE/SSE2 instructions designed for efficient media code manipulation.  Prior Sun Studio 11, user can only use assembler template .il file to take advantage of such instructions.  Sudio 11 offers a set of 128 bit media integer intrinsic functions using XMM registers.

The needed header files can be found in the installation directory SUNWspro/prod/include/cc/
sunmedia_types.h
sunmedia_intrin.h
sys/sunmedia_intrin.h
sys/sunmedia_types.h
 
The optimization backend(when using -xOn, where n=1, 5)  recognizes these intrinsic functions when these options are used

-xarch=amd64 -xbuiltin

Note:
The non-optimization backend(without any -xOn, where n=1, 5) needs venus patch 120759-01, which is available since 12/16/2005, to recognize these integer intrinsic functions.

The intrinsic functions for floating point instructions with 128-bit XMM registers are not available in Sun Studio 11 yet.

SSE3 instructions support (Sun Studio 11)

New SSE3 instructions recognized by x86/x64 assembler in Studio 11.

New -xarch={amd64a, sse2a, ssea, pentium_proa} flags (Sun Studio 11)

New flags -xarch=amd64a,  sse2a,  ssea and pentium_proa were added for 3DNOW!, 3DNOW! extensions and MMX extension generation. 

Note: AMD64 instruction prefetchw will be generated only when these flag values were set.


Revamp of Profile feedback scheme (Sun Studio 11)

x86/x64 Sun Studio 11 has improved the profile feedback scheme to help boosting the performance.  One can use the following sequence of commands to utilize it, for example

//first phase of compilation and execution
>cc -xprofile=collect[:name] -O test.c
>./a.out
//second phase of compilation and execution
>cc -xprofile=use[:name] -O test.c
>./a.out

Where name is your profile data file name, default name is a.out.profile

Be sure to use same version of compiler in both phases.  It is not recommended that one uses an older version of compiler like Sun Studio 10 to do the first phase and keep the profile data file then use Sun Studio 11 to do the second phase compilation with -xprofile=use.  

TLS support (Sun Studio 10 and 11)

Thread-Local storage(TLS) provides a mechanism to allow threads to have global variables which are local to a thread.  Basic support for Thread-Local Storage for x86 and x64 platform was introduced in Sun Studio 10 compilers.  It also coincided with linker suppport for TLS in Solaris 10 for x64 platform(linker support for x86 has been in Solaris 9).

A variable can be declared to be thread_local using the _thread keyword, e.g.,

   __thread int i;

Studio 10 compilers supported the general dynamic and initial exec models of TLS.  Studio 11 compilers enhanced it further with support for local dynamic and local exec models.

The compile time option -xthreadvar can be used to enable the use of TLS with position independnt code in shared libraries.

-xthreadvar can take either of the two values:
 
  dynamic or no%dynamic.

-xthreadvar=no%dynamic generates code for faster access of a thread variable but such object files can only be used in executables.
-xthreadvar=dynamic is required for accessing thread local variables through dynamic loading.  For more details,  please refer to the C User's Guide.

--written by Deepankar Bairagi

Medium Model support(Sun Studio 11)

With x64bit address and instruction available, different memory models are emerging in the compiler.  Sun Studio11 supports medium model. 

New flag and its values introduced for specifying memory models:

-xmodel={kernel, small, medium}  
Note:(provided by Lawrence Crowl)

-xmodel is amd64-only and affects both data and code references
while
-xcode is sparc-only and only affects data references
sparc			data refernces		code references

-xcode=abs32 absolute 32 bits independent 32 bits
-xcode=abs44 absolute 44 bits independent 32 bits
-xcode=abs64 absolute 64 bits independent 32 bits
-xcode=pic13 (-Kpic) independent 13 bits independent 32 bits
-xcode=pic32 (-KPIC) independent 32 bits independent 32 bits

amd64 data refernces code references

-xmodel=small absolute 32 bits absolute 32 bits
-xmodel=medium absolute 64 bits absolute 32 bits
-xmodel=small -KPIC independent 32 bits independent 32 bits
-xmodel=medium -KPIC independent 64 bits independent 32 bits

 Following articles gives more details and info:

  » Alfred Huang's blog on 01/22/06 - "AMD64 Memory Models",
  » Alfred Huang's blog on 01/31/06 - "Kpic under Small model versus Medum Model",
  » Chris Quennel's article on 12/06/2005 - "Sun Studio Support for the AMD64 Medium Memory Model"


Latest x86/x64 Compiler Backend patches - as of 05/31/2007
(click link for the bug fix list or download patch)

Sun Studio 11: 120759-13
Sun Studio 10: 117846-17
Sun Studio 9  : 115982-04
Sun Studio 8  : 112756-13



--created and written by Mei Chung

Posted by x86be ( Feb 13 2006, 05:44:19 PM PST ) Permalink Comments [0]

Trackback URL: http://blogs.sun.com/x86be/entry/news
Comments:

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed

Archives
Patches
Links
Referrers