_mm_sign_pi32

Microsoft Specific

Emits the Supplemental Streaming SIMD Extensions 3 (SSSE3) instruction psignd. This instruction negates or clears 32-bit signed integers of a 64-bit parameter.

__m64 _mm_sign_pi32( 
   __m64 a,
   __m64 b
);

Parameters

  • [in] a
    A 64-bit parameter that contains two 32-bit signed integers.

  • [in] b
    A 64-bit parameter that contains two 32-bit signed integers.

Return value

The return value can be expressed with the following equations.

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

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

Requirements

Intrinsic

Architecture

_mm_sign_pi32

x86, x64

Header file <tmmintrin.h>

Remarks

r0, a0, and b0 are the low order 32 bits of return value r and parameters a and b. r1, a1, and b1 are the high order 32 bits of return value r and parameters a and b.

Before you use this intrinsic, software must ensure that the underlying processor supports the instruction.

Example

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

int main ()
{
    __m64 a, b;

    a.m64_i32[0] = 70000;
    a.m64_i32[1] = -75000;

    b.m64_i32[0] = 0;
    b.m64_i32[1] = -1293;

    __m64 res = _mm_sign_pi32(a, b);

    printf_s("      a\t      b\t    res\n%7d\t%7d\t%7d\n%7d\t%7d\t%7d\n",
                a.m64_i32[0], b.m64_i32[0], res.m64_i32[0],
                a.m64_i32[1], b.m64_i32[1], res.m64_i32[1]);

    _mm_empty();

    return 0;
}
      a       b     res
  70000       0       0
 -75000   -1293   75000

See Also

Concepts

Compiler Intrinsics