Share via


_mm_testz_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_testz_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
r := ZF

Requirements

Intrinsic

Architecture

_mm_testz_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] = 0x55550000BBBB9999;
    b.m128i_u64[0] = 0xAAAAFFFF44446666;

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

    int res1 = _mm_testz_si128(a, b);

    a.m128i_u64[0] = 0x55550000BBCB9999;

    int res2 = _mm_testz_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