Share via


__m64_pshladd2

Microsoft Specific

Emits the IPF Parallel Shift Left and Add (pshladd2) instruction.

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

Parameters

  • [in] a
    An __m64 union containing an array of four 16-bit signed integers to be shifted left and added to.

  • [in] nBit
    The number of bits to left shift the integers in the first array. Valid values from 0 to 3.

  • [in] b
    An __m64 union containing an array of four 16-bit signed integers to add.

Return Value

An __m64 union containing an array of four 16-bit signed integers, the elements of which are computed according to the expression described here.

Requirements

Intrinsic

Architecture

__m64_pshladd2

IPF

Header file <intrin.h>

Remarks

This instruction computes:

c[i] = a[i] << nBit + b[i]

for each of the four elements i of a and b and returns the array c as an __m64 union.

Example

// m64_pshladd2.c
// processor: IPF
#include <stdio.h>
#include <intrin.h>

#pragma intrinsic(__m64_pshladd2)

int main()
{
    __m64 a, b, result;

    a.m64_i16[0] = 0;
    a.m64_i16[1] = 1;
    a.m64_i16[2] = 2;
    a.m64_i16[3] = 100;
    
    b.m64_i16[0] = 1;
    b.m64_i16[1] = 2;
    b.m64_i16[2] = 3;
    b.m64_i16[3] = 4;

    printf_s("Input a: %d %d %d %d\n", a.m64_i16[0],
             a.m64_i16[1], a.m64_i16[2], 
             a.m64_i16[3]);

    printf_s("Input b: %d %d %d %d\n", b.m64_i16[0],
             b.m64_i16[1], b.m64_i16[2],
             b.m64_i16[3]);

    result = __m64_pshladd2(a, 1, b);

    printf_s("Results of pshladd2(a, 1, b): %d %d %d %d\n",
             result.m64_i16[0],
             result.m64_i16[1], result.m64_i16[2],
             result.m64_i16[3]);
}
Input a: 0 1 2 100
Input b: 1 2 3 4
Results of pshladd2(a, 1, b): 1 4 7 204

See Also

Reference

__m64

Compiler Intrinsics