Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.


Microsoft Specific

Emits the Supplemental Streaming SIMD Extensions 3 (SSSE3) instruction pabsw. This instruction returns the absolute value for each packed 16-bit integer of the 64-bit parameter.

__m64 _mm_abs_pi16( 
   __m64 a

[in] a

A 64-bit parameter that contains four 16-bit signed integers for which the absolute values will be returned.

r0 := (a0 < 0) ? -a0 : a0

r1 := (a1 < 0) ? -a1 : a1

r2 := (a2 < 0) ? -a2 : a2

r3 := (a3 < 0) ? -a3 : a3




x86, x64

Header file <tmmintrin.h>

The return value r and parameter a each consist of 64 bits. r0-r3, a0-a3 are the sequentially ordered 16-bit components of these parameters, where r0 and a0 indicate the least significant 16 bits.

Before using this intrinsic, software must ensure that the processor supports the instruction.

#include <stdio.h>
#include <tmmintrin.h>

int main () {
    __m64 a;

    a.m64_i16[0] = 0;
    a.m64_i16[1] = 0;
    a.m64_i16[2] = 32767;
    a.m64_i16[3] = -32767;

    __m64 b = _mm_abs_pi16( a );

    printf_s("Original 16 bit pairs:\n%6d, %6d\n%6d, %6d\n\n",
                a.m64_i16[0], a.m64_i16[1], a.m64_i16[2], a.m64_i16[3]);

    printf_s("New 16 bit pairs:\n%6d, %6d\n%6d, %6d\n",
                b.m64_i16[0], b.m64_i16[1], b.m64_i16[2], b.m64_i16[3]);


    return 0;
Original 16 bit pairs: 0, 0 32767, -32767 New 16 bit pairs: 0, 0 32767, 32767

Community Additions

© 2015 Microsoft