BitMagicC++Library
Data Structures | Functions
SSE2 functions

Processor specific optimizations for SSE2 instructions (internals) More...

Data Structures

class  bm::sse_empty_guard
 SSE2 reinitialization guard class. More...
 

Functions

BMFORCEINLINE void bm::sse2_xor_arr_2_mask (__m128i *BMRESTRICT dst, const __m128i *BMRESTRICT src, const __m128i *BMRESTRICT src_end, bm::word_t mask)
 XOR array elements to specified mask dst = *src ^ mask. More...
 
BMFORCEINLINE void bm::sse2_andnot_arr_2_mask (__m128i *BMRESTRICT dst, const __m128i *BMRESTRICT src, const __m128i *BMRESTRICT src_end, bm::word_t mask)
 Inverts array elements and NOT them to specified mask dst = ~*src & mask. More...
 
BMFORCEINLINE void bm::sse2_and_arr (__m128i *BMRESTRICT dst, const __m128i *BMRESTRICT src, const __m128i *BMRESTRICT src_end)
 AND array elements against another array dst &= *src. More...
 
BMFORCEINLINE void bm::sse2_or_arr (__m128i *BMRESTRICT dst, const __m128i *BMRESTRICT src, const __m128i *BMRESTRICT src_end)
 OR array elements against another array dst |= *src. More...
 
BMFORCEINLINE void bm::sse2_xor_arr (__m128i *BMRESTRICT dst, const __m128i *BMRESTRICT src, const __m128i *BMRESTRICT src_end)
 OR array elements against another array dst ^= *src. More...
 
BMFORCEINLINE void bm::sse2_sub_arr (__m128i *BMRESTRICT dst, const __m128i *BMRESTRICT src, const __m128i *BMRESTRICT src_end)
 AND-NOT (SUB) array elements against another array dst &= ~*src. More...
 
BMFORCEINLINE void bm::sse2_set_block (__m128i *BMRESTRICT dst, __m128i *BMRESTRICT dst_end, bm::word_t value)
 SSE2 block memset dst = value. More...
 
BMFORCEINLINE void bm::sse2_copy_block (__m128i *BMRESTRICT dst, const __m128i *BMRESTRICT src, const __m128i *BMRESTRICT src_end)
 SSE2 block copy dst = *src. More...
 
BMFORCEINLINE void bm::sse2_invert_arr (bm::word_t *first, bm::word_t *last)
 Invert array elements dst = ~*dst or dst ^= *dst. More...
 
bm::id_t bm::sse2_bit_count (const __m128i *block, const __m128i *block_end)
 

Detailed Description

Processor specific optimizations for SSE2 instructions (internals)

Function Documentation

◆ sse2_and_arr()

BMFORCEINLINE void bm::sse2_and_arr ( __m128i *BMRESTRICT  dst,
const __m128i *BMRESTRICT  src,
const __m128i *BMRESTRICT  src_end 
)

AND array elements against another array dst &= *src.

Definition at line 125 of file bmsse_util.h.

References BMFORCEINLINE.

◆ sse2_andnot_arr_2_mask()

BMFORCEINLINE void bm::sse2_andnot_arr_2_mask ( __m128i *BMRESTRICT  dst,
const __m128i *BMRESTRICT  src,
const __m128i *BMRESTRICT  src_end,
bm::word_t  mask 
)

Inverts array elements and NOT them to specified mask dst = ~*src & mask.

Definition at line 97 of file bmsse_util.h.

References BMFORCEINLINE.

◆ sse2_bit_count()

bm::id_t bm::sse2_bit_count ( const __m128i *  block,
const __m128i *  block_end 
)
inline

SSE2 optimized bitcounting function implements parallel bitcounting algorithm for SSE2 instruction set.

unsigned CalcBitCount32(unsigned b)
{
    b = (b & 0x55555555) + (b >> 1 & 0x55555555);
    b = (b & 0x33333333) + (b >> 2 & 0x33333333);
    b = (b + (b >> 4)) & 0x0F0F0F0F;
    b = b + (b >> 8);
    b = (b + (b >> 16)) & 0x0000003F;
    return b;
}

Definition at line 57 of file bmsse2.h.

References BM_ALIGN16, and BM_ALIGN16ATTR.

◆ sse2_copy_block()

BMFORCEINLINE void bm::sse2_copy_block ( __m128i *BMRESTRICT  dst,
const __m128i *BMRESTRICT  src,
const __m128i *BMRESTRICT  src_end 
)

SSE2 block copy dst = *src.

Definition at line 321 of file bmsse_util.h.

References BMFORCEINLINE.

◆ sse2_invert_arr()

BMFORCEINLINE void bm::sse2_invert_arr ( bm::word_t first,
bm::word_t last 
)

Invert array elements dst = ~*dst or dst ^= *dst.

Definition at line 365 of file bmsse_util.h.

References BMFORCEINLINE.

◆ sse2_or_arr()

BMFORCEINLINE void bm::sse2_or_arr ( __m128i *BMRESTRICT  dst,
const __m128i *BMRESTRICT  src,
const __m128i *BMRESTRICT  src_end 
)

OR array elements against another array dst |= *src.

Definition at line 166 of file bmsse_util.h.

References BMFORCEINLINE.

◆ sse2_set_block()

BMFORCEINLINE void bm::sse2_set_block ( __m128i *BMRESTRICT  dst,
__m128i *BMRESTRICT  dst_end,
bm::word_t  value 
)

SSE2 block memset dst = value.

Definition at line 287 of file bmsse_util.h.

References BMFORCEINLINE.

◆ sse2_sub_arr()

BMFORCEINLINE void bm::sse2_sub_arr ( __m128i *BMRESTRICT  dst,
const __m128i *BMRESTRICT  src,
const __m128i *BMRESTRICT  src_end 
)

AND-NOT (SUB) array elements against another array dst &= ~*src.

Definition at line 247 of file bmsse_util.h.

References BMFORCEINLINE.

◆ sse2_xor_arr()

BMFORCEINLINE void bm::sse2_xor_arr ( __m128i *BMRESTRICT  dst,
const __m128i *BMRESTRICT  src,
const __m128i *BMRESTRICT  src_end 
)

OR array elements against another array dst ^= *src.

Definition at line 206 of file bmsse_util.h.

References BMFORCEINLINE.

◆ sse2_xor_arr_2_mask()

BMFORCEINLINE void bm::sse2_xor_arr_2_mask ( __m128i *BMRESTRICT  dst,
const __m128i *BMRESTRICT  src,
const __m128i *BMRESTRICT  src_end,
bm::word_t  mask 
)

XOR array elements to specified mask dst = *src ^ mask.

Definition at line 71 of file bmsse_util.h.

References BMFORCEINLINE.