_mm_sign_pi16
Microsoft Specific
Emits the Supplemental Streaming SIMD Extensions 3 (SSSE3) instruction psignw. This instruction negates or clears 16-bit signed integers of a 64-bit parameter.
__m64 _mm_sign_pi16(
__m64 a,
__m64 b
);
Parameters
[in] a
A 64-bit parameter that contains four 16-bit signed integers.[in] b
A 64-bit parameter that contains four 16-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)
r2 := (b2 < 0) ? -a2 : ((b2 == 0) ? 0 : a2)
r3 := (b3 < 0) ? -a3 : ((b3 == 0) ? 0 : a3)
Requirements
Intrinsic |
Architecture |
---|---|
_mm_sign_pi16 |
x86, x64 |
Header file <tmmintrin.h>
Remarks
r0-r3, a0-a3, and b0-b3 are the sequentially ordered 16-bit components of return value r and parameters a and b. r0, a0, and b0 are the least significant 16 bits.
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_i16[0] = 32000;
a.m64_i16[1] = -6000;
a.m64_i16[2] = 5319;
a.m64_i16[3] = -1753;
b.m64_i16[0] = 1;
b.m64_i16[1] = 0;
b.m64_i16[2] = -1;
b.m64_i16[3] = -4096;
__m64 res = _mm_sign_pi16(a, b);
printf_s(" a\t b\t res\n%6d\t%6d\t%6d\n%6d\t%6d\t%6d\n",
a.m64_i16[0], b.m64_i16[0], res.m64_i16[0],
a.m64_i16[1], b.m64_i16[1], res.m64_i16[1]);
printf_s("%6d\t%6d\t%6d\n%6d\t%6d\t%6d\n",
a.m64_i16[2], b.m64_i16[2], res.m64_i16[2],
a.m64_i16[3], b.m64_i16[3], res.m64_i16[3]);
_mm_empty();
return 0;
}
a b res 32000 1 32000 -6000 0 0 5319 -1 -5319 -1753 -4096 1753