Programming Itanium-based Systems: Developing High Performance Applications for Intel's New Architecture

Using Intrinsics

There are dozens of specialized, highly efficient instructions built into the Itanium processor that compilers can only rarely figure out how to use, based on ordinary high-level code. For example, there are operations equivalent to the Pentium processor s MMX and Streaming SIMD instructions, which operate on up to eight pieces of data in parallel for instance, performing eight byte additions in parallel. Such 8-byte blocks of data have to be aligned on 8-byte boundaries in memory for loads and stores to work correctly. Even if you write a high-level loop to add bytes from one big array to another big array, the compiler may generally not be sure that the memory images are aligned correctly; and even if it wants to use MMX instructions, it may have a hard time figuring out what to do in cases where the number of bytes processed is not a multiple of 8 (boundary conditions). In short, compilers have a very hard time making efficient use of heavily constrained specialized instructions based on ordinary high-level code descriptions.

So how can the compiler be persuaded to make use of these powerful instructions? The solution is to disguise the instructions as special function calls, known as intrinsics. When the compiler sees an intrinsic, it realizes that it should make use of a specific instruction in a very specific way. As an example, when the compiler sees the function _ mm_cmpeq_pi8(), it knows to use the pcmp1.eq instruction to perform eight byte comparisons in parallel. Figure...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Microprocessor and IC Programmers, Compilers, and Debuggers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.