共用方式為


_mm_cvtepi32_epi64

Microsoft Specific

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

__m128i _mm_cvtepi32_epi64( 
   __m128i a
);

Parameters

  • [in] a
    A 128-bit parameter that contains two signed 32-bit integers in the lower 64 bits.

Return value

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

The result is defined as follows:

r0 := a0
r1 := (a0 < 0) ? 0xffffffff : 0
r2 := a1
r3 := (a1 < 0) ? 0xffffffff : 0

Requirements

Intrinsic

Architecture

_mm_cvtepi32_epi64

x86, x64

Header file <smmintrin.h>

Remarks

r0-r3 and a0-a3 are the sequentially ordered 32-bit components of return value r and parameter a, respectively. r0 and a0 are the least significant 32 bits.

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

Example

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

int main ()
{
    __m128i a;

    a.m128i_i32[0] = -2147483647;
    a.m128i_i32[1] = 2147483647;

    __m128i res = _mm_cvtepi32_epi64(a);

    printf_s("Original lowest 32 bit integers:\n%i,\t%i\n\n",
        a.m128i_i32[1], a.m128i_i32[0]);

    printf_s("Resulting 64 bit integers:\n%I64i,\t%I64i\n",
        res.m128i_i64[1], res.m128i_i64[0]);

    return 0;
}
Original lowest 32 bit integers:
2147483647,     -2147483647

Resulting 64 bit integers:
2147483647,     -2147483647

See Also

Reference

Compiler Intrinsics