Export (0) Print
Expand All

_mm_hsubq_epi32

Visual Studio 2010

Visual Studio 2010 SP1 is required.

Microsoft Specific

Generates the XOP instruction vphsubdq to perform an integer horizontal subtract of its source.

__m128i _mm_hsubq_epi32 (
   __m128i src
); 

[in] src

A 128-bit parameter that contains four 32-bit signed integers.

A 128-bit result r that contains two 64-bit signed integers.

r[i] := src[2*i] - src[2*i+1];

Intrinsic

Architecture

_mm_hsubq_epi32

XOP

Header file <intrin.h>

For each of the two even-odd indexed pairs of 32-bit signed integer values in src, the high-order value is subtracted from the low-order value to produce a 64-bit signed integer result that is stored as the corresponding value in the destination.

The vphsubdq instruction is part of the XOP family of instructions. Before you use this intrinsic, you must ensure that the processor supports this instruction. To determine hardware support for this instruction, call the __cpuid intrinsic with InfoType = 0x80000001 and check bit 11 of CPUInfo[2] (ECX). This bit is 1 when the instruction is supported, and 0 otherwise.

#include <stdio.h>
#include <intrin.h>
int main()
{
    __m128i a, d;
    int i;
    a.m128i_i32[0] = 0x80000000;
    a.m128i_i32[1] = 0x7fffffff;
    a.m128i_i32[2] = 0x7fffffff;
    a.m128i_i32[3] = 0x80000000;
    d = _mm_hsubq_epi32(a);
    for (i = 0; i < 4; i++) printf_s(" %10d", a.m128i_i32[i]);
    printf_s("\n");
    for (i = 0; i < 2; i++) printf_s(" %22I64d", d.m128i_i64[i]);
    printf_s("\n");
}
-2147483648 2147483647 2147483647 -2147483648
           -4294967295             4294967295

Community Additions

ADD
Show:
© 2014 Microsoft