Export (0) Print
Expand All
Expand Minimize

_mm_abs_pi32

Updated: February 2009

Microsoft Specific

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

__m64 _mm_abs_pi32( 
   __m64 a
);

[in] a

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

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

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

Intrinsic

Architecture

_mm_abs_pi32

x86, x64

Header file <tmmintrin.h>

The return value r and parameter a each consist of 64 bits. r0-r1, a0-a1 are the sequentially ordered 32-bit components of these parameters, where r0 and a0 indicate the least significant 32 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_i32[0] = 2147483647;
    a.m64_i32[1] = -2147483647;

    __m64 b = _mm_abs_pi32( a );

    printf_s("Original 32 bit pairs:\n0x%08x, 0x%08x\n\n",
                a.m64_i32[0], a.m64_i32[1]);

    printf_s("New 32 bit pairs:\n0x%08x, 0x%08x\n",
                b.m64_i32[0], b.m64_i32[1]);
    _mm_empty();

    return 0;
}
Original 32 bit pairs: 0x7fffffff, 0x80000001 New 32 bit pairs: 0x7fffffff, 0x7fffffff

Date

History

Reason

February 2009

Updated the content to refer to 32-bit integers.

Content bug fix.

Community Additions

ADD
Show:
© 2015 Microsoft