__m64_padd2uus

Microsoft Specific

Emits the IPF padd2.uus instruction (the 2-byte, unsigned, unsigned, signed saturation form of Parallel Add).

__m64 __m64_padd2uus( 
   __m64 a, 
   __m64 b 
);

Parameters

  • [in] a
    The first 64-bit field containing 2-byte sections to be added.

  • [in] b
    The second 64-bit field containing 2-byte sections to be added.

Requirements

Intrinsic

Architecture

__m64_padd1uus

IPF

Header file <intrin.h>

Remarks

__m64_padd2uus adds each 2-byte section of one operand with the corresponding 2-byte section of the second operand and puts the result in the corresponding 2-byte section of the result. The values from the first operand are considered unsigned, and the values from the second operand are considered signed. The resulting values are considered unsigned.

If the result of the addition overflows 2 bytes, the value saturates and the 16-bit section is set to 0xFFFF. If the result of the addition underflows, the 16 bits are set to zero.

Example

// padd2uus.cpp
// processor: IPF
#include <stdio.h>
#include <intrin.h>

#pragma intrinsic(__m64_padd2uus)

int main()
{
    __m64 m, n, result;
    m.m64_i64 = 0x110022003300ff00;  
    n.m64_i64 = 0x01100220033000ff;
    result = __m64_padd2uus(m, n);
    printf_s("__m64_padd2uus(%#18I64x, %#18I64x) ==\n %#18I64x\n",
             m, n, result);

    // This operation is not commutative!  The second parameter
    // is signed, so 0xff00 will be interpreted as a negative 
    // integer (-256). When added to 0x00ff (256), the result is 0.
    result = __m64_padd2uus(n, m);
    printf_s("__m64_padd2uus(%#18I64x, %#18I64x) ==\n %#18I64x\n",
             n, m, result);
}
__m64_padd2uus(0x110022003300ff00,  0x1100220033000ff) ==
 0x121024203630ffff
__m64_padd2uus( 0x1100220033000ff, 0x110022003300ff00) ==
 0x1210242036300000

See Also

Reference

__m64

Compiler Intrinsics