Bagikan melalui


_mm_testnzc_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_testnzc_si128( 
   __m128i a,
   __m128i b 
);

Parameters

  • [in] a
    A 128-bit value.

  • [in] b
    A 128-bit value.

Return value

Generates a return value of 0 or 1 based on the following equations.

ZF := (a & b) == 0
CF := (~a & b) == 0
r := ~ZF & ~CF

Requirements

Intrinsic

Architecture

_mm_testnzc_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] = 0x000000000000000;
    b.m128i_u64[0] = 0xFFFFFFFFFFFFFFF;

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

    int res1 = _mm_testnzc_si128(a, b);

    a.m128i_u64[0] = 0x000000000000001;

    int res2 = _mm_testnzc_si128(a, b);

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

    return 0;
}

First result should be 0: 0 Second result should be 1: 1

See Also

Reference

Compiler Intrinsics