Export (0) Print
Expand All
Expand Minimize

_mm_cvtepi16_epi32

Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction pmovsxwd. This instruction performs a conversion of signed integers from 16-bit to 32-bit.

__m128i _mm_cvtepi16_epi32( 
   __m128i a
);

[in] a

A 128-bit parameter that contains four signed 16-bit integers in the lower 64 bits.

A 128-bit parameter that contains four 32-bit integers. These integers are sign-extended representations of the 16-bit integers that are supplied by a.

Intrinsic

Architecture

_mm_cvtepi16_epi32

x86, x64

Header file <smmintrin.h>

The result is defined as follows:

r0 := a0
r1 := (a0 < 0) ? 0xffff : 0

r2 := a1
r3 := (a1 < 0) ? 0xffff : 0

r4 := a2
r5 := (a2 < 0) ? 0xffff : 0

r6 := a3
r7 := (a3 < 0) ? 0xffff : 0

r0-r7 and a0-a7 are the sequentially ordered 16-bit components of return value r and parameter a, respectively. r0 and a0 are the least significant 16 bits.

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

#include <stdio.h>
#include <smmintrin.h>

int main ()
{
    __m128i a;

    a.m128i_i16[0] = 32767;
    a.m128i_i16[1] = -32768;
    a.m128i_i16[2] = 0;
    a.m128i_i16[3] = -1;

    __m128i res = _mm_cvtepi16_epi32(a);

    printf_s("Original lowest 16 bit integers:\n%8i, %8i\n%8i, %8i\n\n",
        a.m128i_i16[3], a.m128i_i16[2], a.m128i_i16[1], a.m128i_i16[0]);

    printf_s("Resulting 32 bit integers:\n%8i, %8i\n%8i, %8i\n",
        res.m128i_i32[3], res.m128i_i32[2], res.m128i_i32[1], res.m128i_i32[0]);

    return 0;
}
Original lowest 16 bit integers: -1, 0 -32768, 32767 Resulting 32 bit integers: -1, 0 -32768, 32767

Community Additions

ADD
Show:
© 2014 Microsoft