Integer Logical Operations for Streaming SIMD Extensions 2

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

For detailed information about an intrinsic, click on that intrinsic name in the following table.

The results of each intrinsic operation are placed in register R. The information about what is placed in each register appears in the tables below, in the detailed explanation of each intrinsic.

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

Intrinsic
Name
Operation Corresponding SSE2
Instruction
_mm_and_si128 Computes AND PAND
_mm_andnot_si128 Computes AND and NOT PANDN
_mm_or_si128 Computes OR POR
_mm_xor_si128 Computes XOR PXOR

 

__m128i _mm_and_si128(__m128i a, __m128i b)

Computes the bitwise AND of the 128-bit value in a and the 128-bit value in b.

R0
a & b

 

__m128i _mm_andnot_si128(__m128i a, __m128i b)

Computes the bitwise AND of the 128-bit value in b and the bitwise NOT of the 128-bit value in a.

R0
(~a) & b

 

__m128i _mm_or_si128(__m128i a, __m128i b)

Computes the bitwise OR of the 128-bit value in a and the 128-bit value in b.

R0
a | b

 

__m128i _mm_xor_si128(__m128i a, __m128i b)

Computes the bitwise XOR of the 128-bit value in a and the 128-bit value in b.

R0
a ^ b