Developer Guide and Reference

Contents

C++ Classes and SIMD Operations

Use of C++ classes for SIMD operations allows for operating on arrays or vectors of data in a single operation. Consider the addition of two vectors,
A
and
B
, where each vector contains four elements. Using an integer vector class, the elements
A[i]
and
B[i]
from each array are summed as shown in the following example.

Typical Method of Adding Elements Using a Loop

int a[4], b[4], c[4]; for (i=0; i<4; i++) /* needs four iterations */ c[i] = a[i] + b[i]; /* computes c[0], c[1], c[2], c[3] */
The following example shows the same results using one operation with an integer class.

SIMD Method of Adding Elements Using Ivec Classes

Is16vec4 ivecA, ivecB, ivec C; /*needs one iteration*/ ivecC = ivecA + ivecB; /*computes ivecC0, ivecC1, ivecC2, ivecC3 */

Available Classes

The Intel® C++ SIMD classes provide parallelism, which is not easily implemented using typical mechanisms of C++. The following table shows how the Intel® C++ classes use the SIMD classes and libraries.
SIMD Vector Classes
Instruction Set
Class
Signedness
Data Type
Size
Elements
Header File
MMX™ technology
I64vec1
unspecified
__m64
64
1
ivec.h