Developer Guide and Reference

Contents

Integer Intrinsics

The prototypes for Intel® Streaming SIMD Extensions (Intel® SSE) intrinsics for integer operations are in the
xmmintrin.h
header file.
To use these intrinsics, include the
immintrin.h
file as follows:
#include <immintrin.h>
The results of each intrinsic operation are placed in registers. The information about what is placed in each register appears in the tables below, in the detailed explanation of each intrinsic. R, R0, R1, ..., R7 represent the registers in which results are placed.
Before using these intrinsics, you must empty the multimedia state for the MMX™ technology register. See The EMMS Instruction: Why You Need It for more details.
Intrinsic Name
Operation
Corresponding
Intel® SSE Instruction
_mm_extract_pi16
Extract one of four words
PEXTRW
_mm_insert_pi16
Insert word
PINSRW
_mm_max_pi16
Compute maximum
PMAXSW
_mm_max_pu8
Compute maximum, unsigned
PMAXUB
_mm_min_pi16
Compute minimum
PMINSW
_mm_min_pu8
Compute minimum, unsigned
PMINUB
_mm_movemask_pi8
Create eight-bit mask
PMOVMSKB
_mm_mulhi_pu16
Multiply, return high bits
PMULHUW
_mm_shuffle_pi16
Return a combination of four words
PSHUFW
_mm_maskmove_si64
Conditional Store
MASKMOVQ
_mm_avg_pu8
Compute rounded average
PAVGB
_mm_avg_pu16
Compute rounded average
PAVGW
_mm_sad_pu8
Compute sum of absolute differences
PSADBW

_mm_extract_pi16

int _mm_extract_pi16(__m64 a, int n);
Extracts one of the four words of
a
. The selector
n
must be an immediate.
R
(n==0) ? a0 : ( (n==1) ? a1 : ( (n==2) ? a2 : a3 ) )

_mm_insert_pi16

__m64 _mm_insert_pi16(__m64 a, int d, int n);
Inserts word
d
into one of four words of
a
. The selector
n
must be an immediate.
R0
R1
R2
R3
(n==0) ? d : a0;
(n==1) ? d : a1;
(n==2) ? d : a2;
(n==3) ? d : a3;

_mm_max_pi16

__m64 _mm_max_pi16(__m64 a, __m64 b);
Computes the element-wise maximum of the words in
a
and
b
.
R0
R1
R2
R3
min(a0, b0)