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
 
I32vec2
unspecified
int
32
2
ivec.h
 
Is32vec2
signed
int
32
2
ivec.h
 
Iu32vec2
unsigned
int
32
2
ivec.h
 
I16vec4
unspecified
short
16
4
ivec.h
 
Is16vec4
signed
short
16
4
ivec.h
 
Iu16vec4
unsigned
short
16
4
ivec.h
 
I8vec8
unspecified
char
8
8
ivec.h
 
Is8vec8
signed
char
8
8
ivec.h
 
Iu8vec8
unsigned
char
8
8
ivec.h
Intel® SSE
F32vec4
unspecified
float
32
4
fvec.h
 
F32vec1
unspecified
float
32
1
fvec.h
Intel® SSE2
F64vec2
unspecified
double
64
2
dvec.h
 
I128vec1
unspecified
__m128i
128
1
dvec.h
 
I64vec2
unspecified
long int
64
2