The following four logical-operation intrinsics and their respective instructions are functional as part of Streaming SIMD Extensions 2 (SSE2).

The prototypes for SSE2 intrinsics are in the emmintrin.h header file.

__m128i _mm_and_si128(__m128i a, __m128i b)

(uses PAND) Computes the bitwise
AND of the 128-bit value in a and the 128-bit
value in b.

r := a & b

__m128i _mm_andnot_si128(__m128i a, __m128i b)

(uses PANDN) Computes the bitwise
AND of the 128-bit value in b and the bitwise
NOT of the 128-bit value in a.

r := (~a) & b

__m128i _mm_or_si128(__m128i a, __m128i b)

(uses POR) Computes the bitwise
OR of the 128-bit value in a and the 128-bit value
in b.

r := a | b

__m128i _mm_xor_si128(__m128i a, __m128i b)

(uses PXOR) Computes the bitwise
XOR of the 128-bit value in a and the 128-bit
value in b.

r := a ^ b