This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: compiling xmmintrin.h


ranjith kumar wrote:
Hi,
    I wrote a c program which uses functions and data
types defined in xmmintrin.h.
 Suprisingly,  in assembly code, produced by gcc, each
function call is replaced by a single assembly
instruction.

What is the special about functions defined in
xmmintrin.h.
How they are compiled by gcc?

Any answers or any matirial?
Thanks in advance.


These intrinsics were developed as a way of programming at a lower level, without being tied exclusively to one instruction set or assembler syntax. So, the code should be portable between commercial compilers and gcc, and between 32-bit/x86-64/ia64. They also provide a way to optimize by use of parallel instructions, in situations where vectorization doesn't work, or when a less capable compiler is in use. Not that I would use them as a way of persuading gcc-3.2 or MSVC to do what gcc-4.3 does by auto-vectorization.
You could learn a lot about them simply by studying xmmintrin.h. The gcc version is more readable than the commercial ones, but they have much the same content. To some extent, it's a way of automatically changing asm macros when you change target platforms, within the implemented range, as well as providing an alternative to each programmer inventing new wheels.
Google will give you some hints about additional reading material. It doesn't matter whether you use the Windows or linux oriented articles.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]