Developer Guide and Reference

Contents

Subtraction Intrinsics

These Supplemental Streaming SIMD Extensions 3 (SSSE3) intrinsics are used for horizontal subtraction. The prototypes for these intrinsics are in
tmmintrin.h
.
To use these intrinsics, include the
immintrin.h
file as follows:
#include <immintrin.h>

_mm_hsub_epi16

extern __m128i _mm_hsub_epi16(__m128i a, __m128i b);
Subtract horizontally packed signed words.
Interpreting
a
,
b
, and
r
as arrays of 16-bit signed integers:
for (i = 0; i < 4; i++) { r[i] = a[2*i] - a[2i+1]; r[i+4] = b[2*i] - b[2*i+1]; }

_mm_hsub_epi32

extern __m128i _mm_hsub_epi32(__m128i a, __m128i b);
Subtracts horizontally packed signed doublewords.
Interpreting
a
,
b
, and
r
as arrays of 32-bit signed integers:
for (i = 0; i < 2; i++) { r[i] = a[2*i] - a[2i+1]; r[i+2] = b[2*i] - b[2*i+1]; }

_mm_hsubs_epi16

extern __m128i _mm_hsubs_epi16(__m128i a, __m128i b);
Subtracts horizontally packed signed words with signed saturation.
Interpreting
a
,
b
, and
r
as arrays of 16-bit signed integers:
for (i = 0; i < 4; i++) { r[i] = signed_saturate_to_word(a[2*i] - a[2i+1]); r[i+4] = signed_saturate_to_word(b[2*i] - b[2*i+1]); }

_mm_hsub_pi16