共用方式為


_mm_mullo_epi32

Microsoft Specific

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

__m128i _mm_mullo_epi32( 
   __m128i a,
   __m128i b 
);

Parameters

  • [in] a
    A 128-bit parameter that contains four 32-bit signed integers.

  • [in] b
    A 128-bit parameter that contains four 32-bit signed integers.

Return value

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

r0 := a0 * b0
r1 := a1 * b1
r2 := a2 * b2
r3 := a3 * b3

Requirements

Intrinsic

Architecture

_mm_mullo_epi32

x86, x64

Header file <smmintrin.h>

Remarks

Only the lower 32-bits of each product are saved.

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] = 65535;
    a.m128i_i32[1] = -512;
    a.m128i_i32[2] = 77910;
    a.m128i_i32[3] = 0;

    b.m128i_i32[0] = 2;
    b.m128i_i32[1] = 4431;
    b.m128i_i32[2] = -7969;
    b.m128i_i32[3] = 240000000;

    __m128i res = _mm_mullo_epi32(a, b);

    printf_s("              a              b            res\n");
    printf_s("%15d%15d%15d\n%15d%15d%15d\n%15d%15d%15d\n%15d%15d%15d\n",
                a.m128i_i32[0], b.m128i_i32[0], res.m128i_i32[0],
                a.m128i_i32[1], b.m128i_i32[1], res.m128i_i32[1],
                a.m128i_i32[2], b.m128i_i32[2], res.m128i_i32[2],
                a.m128i_i32[3], b.m128i_i32[3], res.m128i_i32[3]);

    return 0;
}
              a              b            res
          65535              2         131070
           -512           4431       -2268672
          77910          -7969     -620864790
              0      240000000              0

See Also

Concepts

Compiler Intrinsics