Files
2025-10-25 03:02:53 +03:00

4.6 KiB
Raw Permalink Blame History

[simd.general]

29 Numerics library [numerics]

29.10 Data-parallel types [simd]

29.10.1 General [simd.general]

1

#

Subclause [simd] defines data-parallel types and operations on these types.

[Note 1:

The intent is to support acceleration through data-parallel execution resources where available, such as SIMD registers and instructions or execution units driven by a common instruction decoder.

SIMD stands for “Single Instruction Stream – Multiple Data Stream”; it is defined in Flynn 1966[bib].

— end note]

2

#

The set of vectorizable types comprises

all standard integer types, character types, and the types float and double ([basic.fundamental]);

std::float16_t, std::float32_t, and std::float64_t if defined ([basic.extended.fp]); and

complex where T is a vectorizable floating-point type.

3

#

The term data-parallel type refers to all enabled specializations of the basic_vec and basic_mask class templates.

A data-parallel object is an object of data-parallel type.

4

#

Each specialization of basic_vec or basic_mask is either enabled or disabled, as described in [simd.overview] and[simd.mask.overview].

5

#

A data-parallel type consists of one or more elements of an underlying vectorizable type, called the element type.

The number of elements is a constant for each data-parallel type and called thewidth of that type.

The elements in a data-parallel type are indexed from 0 to width−1.

6

#

An element-wise operation applies a specified operation to the elements of one or more data-parallel objects.

Each such application is unsequenced with respect to the others.

A unary element-wise operation is an element-wise operation that applies a unary operation to each element of a data-parallel object.

A binary element-wise operation is an element-wise operation that applies a binary operation to corresponding elements of two data-parallel objects.

7

#

Given a basic_mask<Bytes, Abi> object mask, theselected indices signify the integers i in the range [0, mask.size()) for which mask[i] is true.

Given a data-parallel object data, the selected elements signify the elements data[i] for all selected indices i.

8

#

The conversion from an arithmetic type U to a vectorizable typeT is value-preserving if all possible values of U can be represented with type T.