共用方式為


_mm_hsub_pi32

Microsoft Specific

Emits the Supplemental Streaming SIMD Extensions 3 (SSSE3) instruction phsubd. This instruction computes the difference between the elements of two 64-bit parameters.

__m64 _mm_hsub_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

A 64-bit parameter that contains two 32-bit signed integers. Each integer is the difference between adjacent pairs of elements in the input parameters.

The result can be expressed with the following equations:

r0 := a0 - a1
r1 := b0 - b1

Requirements

Intrinsic

Architecture

_mm_hsub_pi32

x86, x64

Header file <tmmintrin.h>

Remarks

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

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

Example

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

int main ()
{
    __m64 a, b;

    a.m64_i32[0] = 32;
    a.m64_i32[1] = 32;
    b.m64_i32[0] = 32000;
    b.m64_i32[1] = 65535;

    __m64 res = _mm_hsub_pi32(a, b);

    printf_s("Original a:\t%6d\t%6d\nOriginal b:\t%6d\t%6d\n",
                a.m64_i32[0], a.m64_i32[1], b.m64_i32[0], b.m64_i32[1]);
    printf_s("Result res:\t%6d\t%6d\n",
                res.m64_i32[0], res.m64_i32[1]);

    _mm_empty();

    return 0;
}
Original a:         32      32
Original b:      32000   65535
Result res:          0  -33535

See Also

Reference

Compiler Intrinsics