Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Absolute Value Intrinsics

These Supplemental Streaming SIMD Extensions 3 (SSSE3) intrinsics are used to compute absolute values. The prototypes for these intrinsics are in tmmintrin.h.

To use these intrinsics, include the immintrin.h file as follows:

#include <immintrin.h>

_mm_abs_epi8

extern __m128i _mm_abs_epi8(__m128i a);

Computes absolute value of signed bytes. Interpreting a and r as arrays of signed 8-bit integers:

for (i = 0; i < 16; i++) {
r[i] = abs(a[i]);
}

_mm_abs_epi16

extern __m128i _mm_abs_epi16(__m128i a);

Computes absolute value of signed words. Interpreting a and r as arrays of signed 16-bit integers:

for (i = 0; i < 8; i++) {
r[i] = abs(a[i]);
}

_mm_abs_epi32

extern __m128i _mm_abs_epi32(__m128i a);

Computes absolute value of signed doublewords. Interpreting a and r as arrays of signed 32-bit integers:

for (i = 0; i < 4; i++) {
r[i] = abs(a[i]);
}

_mm_abs_pi8

extern __m64 _mm_abs_pi8(__m64 a);

Computes absolute value of signed bytes. Interpreting a and r as arrays of signed 8-bit integers:

for (i = 0; i < 8; i++) {
r[i] = abs(a[i]);
}

_mm_abs_pi16

extern __m64 _mm_abs_pi16(__m64 a);

Computes absolute value of signed words. Interpreting a and r as arrays of signed 16-bit integers:

for (i = 0; i < 4; i++) {
r[i] = abs(a[i]);
}

_mm_abs_pi32

extern __m64 _mm_abs_pi32(__m64 a);

Computes absolute value of signed doublewords. Interpreting a and r as arrays of signed 32-bit integers:

for (i = 0; i < 2; i++) {
r[i] = abs(a[i]);
}