__m64_pshradd2

Microsoft Specific

Emits the IPF Parallel Shift Right and Add (pshradd2) instruction.

__m64 __m64_pshradd2( 
   __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 right and added to.

  • [in] nBit
    The number of bits to right 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_pshradd2

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_pshradd2.c
// processor: IPF
#include <stdio.h>
#include <intrin.h>

#pragma intrinsic(__m64_pshradd2)

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

    a.m64_i16[0] = 0;
    a.m64_i16[1] = 2;
    a.m64_i16[2] = 16;
    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_pshradd2(a, 1, b);

    printf_s("Results of pshradd2(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 2 16 100
Input b: 1 2 3 4
Results of pshradd2(a, 1, b): 1 3 11 54

See Also

Reference

__m64

Compiler Intrinsics