Bagikan melalui


_mm_mul_epi32

Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction pmuldq. This instruction multiplies two sets of 32-bit signed integers.

__m128i _mm_mul_epi32( 
   __m128i a,
   __m128i b 
);

Parameters

  • [in] a
    A 128-bit parameter that contains two 32-bit signed integers in the low half of each quadword.

  • [in] b
    A 128-bit parameter that contains two 32-bit signed integers in the low half of each quadword.

Return value

A 128-bit value that contains two 64-bit signed integers. The result can be expressed by the following equations.

r0 := low_half(a0 * b0)
r1 := high_half(a0 * b0)
r2 := low_half(a2 * b2)
r3 := high_half(a2 * b2)

Requirements

Intrinsic

Architecture

_mm_mul_epi32

x86, x64

Header file <smmintrin.h>

Remarks

The upper 32-bits of each quadword of the input parameters are not used.

r0-r3, a0-a3, and b0-b3 are the sequentially ordered 32-bit components of return value r and parameters a and b. r0, a0, and b0 indicates 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, b;

    a.m128i_i32[0] = 65000;
    a.m128i_i32[1] = 0;
    a.m128i_i32[2] = 24000000;
    a.m128i_i32[3] = 0;

    b.m128i_i32[0] = -320000;
    b.m128i_i32[1] = 0;
    b.m128i_i32[2] = 56400000;
    b.m128i_i32[3] = 0;

    __m128i res = _mm_mul_epi32(a, b);

    printf_s("Result res: \t%I64d\n\t\t%I64d\n",
                res.m128i_i64[0], res.m128i_i64[1]);

    return 0;
}

Result res: -20800000000 1353600000000000

See Also

Reference

Compiler Intrinsics