C++ Classes and SIMD Operations

The use of C++ classes for SIMD operations is based on the concept of operating on arrays, or vectors of data, in parallel. 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.

Rules for Operators

To use operators with the Ivec classes you must use one of the following three syntax conventions:

[ Ivec_Class ] R = [ Ivec_Class ] A [ operator ][ Ivec_Class ] B

Example 1: I64vec1 R = I64vec1 A & I64vec1 B;

[ Ivec_Class ] R =[ operator ] ([ Ivec_Class ] A,[ Ivec_Class ] B)

Subscribe to Linux*