Поделиться через


Intrinsic Conventions

Microsoft Specific

The intrinsics use the following syntax notation convention:

_mm_<intrin_op>_<suffix>

where <intrin_op> indicates the intrinsic's basic operation (for example, add for addition and sub for subtraction) and <suffix> denotes the type of data operated on by the instruction. The first one or two letters of each suffix denotes whether the data is packed (p), extended packed (ep), or scalar (s).

The remaining letters denote the type:

  • s
    Single-precision floating point

  • d
    Double-precision floating point

  • i128
    Signed 128-bit integer

  • i64
    Signed 64-bit integer

  • u64
    Unsigned 64-bit integer

  • i32
    Signed 32-bit integer

  • u32
    Unsigned 32-bit integer

  • i16
    Signed 16-bit integer

  • u16
    Unsigned 16-bit integer

  • i8
    Signed 8-bit integer

  • u8
    Unsigned 8-bit integer

The packed values are represented in right-to-left order, with the lowest value being used for scalar operations. Consider the following example operation:

double a[2] = {1.0, 2.0};
__m128d t = _mm_load_pd(a);

The result is the same as either of the following:

__m128d t = _mm_set_pd(2.0, 1.0);
__m128d t = _mm_setr_pd(1.0, 2.0);

In other words, the xmm register that holds the value t will look as follows:

XMM register graphic

The scalar element is 1.0. Because of the nature of the instruction, some intrinsics require their arguments to be immediates (constant integer literals).

Intrinsic Syntax

The following is the syntax for each intrinsic:

data_type intrinsic_name (parameters)

where data_type is the return data type (which can be void, int, __m64, __m128, __m128d, or __m128i, and only the _mm_empty intrinsic returns void) and intrinsic_name is the name of the intrinsic (which behaves like a function that you can use in your C/C++ code instead of inlining the actual instruction).

A table in each section provides the intrinsic names and the corresponding instruction. A detailed description of the intrinsic with the intrinsic's prototype and its corresponding instruction follow each table.

END Microsoft Specific

See Also

Reference

Intel Overview of New Instructions and Extensions