_mm_testc_si128

Microsoft Specific

Emits the Streaming SIMD Extensions 4 (SSE4) instruction ptest. This instruction performs a bitwise comparison between two 128-bit parameters.

int _mm_testc_si128( 
   __m128i a,
   __m128i b 
);

Parameters

  • [in] a
    A 128-bit value.

  • [in] b
    A 128-bit value.

Return value

1 if all the bits set in b are set in a; otherwise 0.

Requirements

Intrinsic

Architecture

_mm_testc_si128

x86, x64

Header file <smmintrin.h>

Remarks

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_u64[0] = 0xAAAA55551111FFFF;
    b.m128i_u64[0] = 0xAAAA55551111FFFF;

    a.m128i_u64[1] = 0xFEDCBA9876543210;
    b.m128i_u64[1] = 0xFEDCBA9876543210;

    int res1 = _mm_testc_si128(a, b);

    a.m128i_u64[0] = 0xAAAA55551011FFFF;

    int res2 = _mm_testc_si128(a, b);

    printf_s("First result should be 1: %d\nSecond result should be 0: %d\n",
                res1, res2);

    return 0;
}
First result should be 1: 1
Second result should be 0: 0

See Also

Reference

Compiler Intrinsics