Condividi tramite


__m64_shladd

Microsoft Specific

Emits the IPF Shift Left and Add (shladd) instruction.

__m64 __m64_shladd( 
   __m64 a, 
   const int nBit, 
   __m64 b 
);

Parameters

  • [in] a
    An __m64 union containing a 64-bit integer.

  • [in] nBit
    The number of bits shifted left. Valid values are 1, 2, 3, or 4.

  • [in] b
    An __m64 union containing a 64-bit integer.

Return Value

The result of the left shift of a by nBit bytes, followed by addition of b.

Requirements

Intrinsic

Architecture

__m64_shladd

IPF

Header file <intrin.h>

Remarks

The result computed and returned is a * 2^nBit + b.

Example

// shladd.cpp
// processor: IPF
#include <stdio.h>
#include <intrin.h>

#pragma intrinsic(__m64_shladd)

void print(__int64 a, int nBit, __int64 b, __int64 c)
{
    printf_s("__m64_shladd(%I64d, %d, %I64d) returns %I64d\n",
             a, nBit, b, c);
}

int main()
{
    __m64 m, n, result;
    m.m64_i64 = 15;  
    n.m64_i64 = 7; 
    result = __m64_shladd(m, 1, n);
    print(m.m64_i64, 1, n.m64_i64, result.m64_i64);

    result = __m64_shladd(m, 2, n);
    print(m.m64_i64, 2, n.m64_i64, result.m64_i64);

    result = __m64_shladd(m, 3, n);
    print(m.m64_i64, 3, n.m64_i64, result.m64_i64);

    result = __m64_shladd(m, 4, n);
    print(m.m64_i64, 4, n.m64_i64, result.m64_i64);

}

__m64_shladd(15, 1, 7) returns 37
__m64_shladd(15, 2, 7) returns 67
__m64_shladd(15, 3, 7) returns 127
__m64_shladd(15, 4, 7) returns 247

See Also

Concepts

__m64

Compiler Intrinsics