Ignore:
Timestamp:
Oct 21, 2011, 6:28:09 PM (8 years ago)
Author:
ksherdy
Message:

Prefer static function overloading on bitblock128_t types for performance. Methods templated on BitBlock? type do not inline efficiently.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/bitblock.hpp

    r1527 r1542  
    66       under the Academic Free License version 3.0.
    77*/
    8 
    98#ifndef BITBLOCK_HPP
    109#define BITBLOCK_HPP
    1110
    12 /*  Default BLOCKSIZE is 128, compatible with SSE, Altivec, SPU */
    13 #ifndef BLOCKSIZE                       // TODO - Remove BLOCKSIZE switcher
     11#include <stdint.h>
     12#include <stdio.h>
     13#include "config.hpp"
     14#include "builtins.hpp"
     15#include "idisa.hpp"
     16
     17#ifndef BLOCKSIZE
    1418#define BLOCKSIZE 128
    1519#endif
    1620
     21/*  Default BLOCKSIZE is 128, compatible with SSE, Altivec, SPU */
    1722#if (BLOCKSIZE == 128)
     23#include "idisa128.hpp"
    1824#include "bitblock128.hpp"
    1925#endif
     
    2127/*  BLOCKSIZE 256 for AVX */
    2228#if (BLOCKSIZE == 256)
     29#include "idisa256.hpp"
    2330#include "bitblock256.hpp"
    2431#endif
    2532
    26 #include "config.hpp"
    27 #include "builtins.hpp"
    28 #include <stdio.h>
     33/* Wrapper Declarations */
    2934
    30 /* Wrapper Declarations */
    3135#define sisd_sll(blk, n) simd<128>::sll(blk, n)         // TODO - Deprecate 'sisd_f(x,y)'. bitblock_f(x,y) Migrate to simd<sizeof(BitBlock)*8>::f(x,y) or simd<bitblock128_t, 128>::f(x,y)
    3236#define sisd_srl(blk, n) simd<128>::srl(blk, n)
     
    4044#define sf_op(x, n) ((x)<<(n))
    4145
    42 /* Utility */
    43 template<class T> IDISA_INLINE bool bitblock_has_bit(T arg1);
    44 template<class T> IDISA_INLINE uint64_t bitblock_bit_count(T arg1) IDISA_ALWAYS_INLINE;
    4546
    46 /* Debug */
    4747template<class T> void print_register(const char * var_name, T v);      // print integer types as array of unsigned char
    48 
    49 /* Utility */
    50 template<class T>
    51 IDISA_INLINE bool bitblock_has_bit(T arg1)
    52 {
    53         return bitblock::any(arg1);
    54 }
    55 
    56 template<class T>
    57 IDISA_INLINE uint64_t bitblock_bit_count(T arg1)
    58 {
    59         return mvmd<64>::extract<0>(simd<sizeof(T) * 8>::popcount(arg1));
    60 }
    6148
    6249/* Debug */
Note: See TracChangeset for help on using the changeset viewer.