Compartilhar via


_mm_maccs_epi16

[Note: This document describes a pre-release version of Visual Studio 2010 SP1 and may be revised in any later version.]

Visual Studio 2010 SP1 is required.

Microsoft Specific

Generates the XOP instruction vpmacssww to perform a saturating integer multiply-add of its sources.

__m128i _mm_maccs_epi16 (
   __m128i src1,
   __m128i src2,
   __m128i src3
); 

Parameters

  • [in] src1
    A 128-bit parameter that contains eight 16-bit signed integers.

  • [in] src2
    A 128-bit parameter that contains eight 16-bit signed integers.

  • [in] src3
    A 128-bit parameter that contains eight 16-bit signed integers.

Return value

A 128-bit result r that contains eight 16-bit signed integers.

r[i] := src1[i] * src2[i] + src3[i];

Requirements

Intrinsic

Architecture

_mm_maccs_epi16

XOP

Header file <intrin.h>

Remarks

Each 16-bit signed integer value in src1 is multiplied by the corresponding 16-bit signed integer value in src2. The 32-bit signed integer product is added to the corresponding 16-bit signed integer value in src3, and the signed 16-bit integer result is stored as the corresponding value in the destination.

If the result of the addition to the 32-bit product is greater than 32767 (0x7FFF) or less than -32768 (0x8000), the multiply-add saturates by setting the result value to 32767 or -32768, respectively.

The vpmacssww instruction is part of the XOP family of instructions. Before you use this intrinsic, you must ensure that the processor supports this instruction. To determine hardware support for this instruction, call the __cpuid intrinsic with InfoType = 0x80000001 and check bit 11 of CPUInfo[2] (ECX). This bit is 1 when the instruction is supported, and 0 otherwise.

Example

#include <stdio.h>
#include <intrin.h>
int main()
{
    __m128i a, b, c, d;
    int i;
    for (i = 0; i < 8; i++) {
        a.m128i_i16[i] = i - 4;
        b.m128i_i16[i] = 10000;
        c.m128i_i16[i] = 7000;
    }
    d = _mm_maccs_epi16(a, b, c);
    for (i = 0; i < 8; i++) printf_s(" %d", d.m128i_i16[i]);
    printf_s("\n");
}
-32768 -23000 -13000 -3000 7000 17000 27000 32767

See Also

Reference

_mm_macc_epi16

_mm_maccd_epi16

_mm_maccsd_epi16

__cpuid, __cpuidex

XOP Intrinsics Added for Visual Studio 2010 SP1

Change History

Date

History

Reason

March 2011

Added this content.

SP1 feature change.