Changeset 1617 for trunk/lib/bitblock.hpp
 Timestamp:
 Oct 31, 2011, 3:44:18 AM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/lib/bitblock.hpp
r1616 r1617 1 1 /* 2 2 IDISA Library Import  Generic 3 Copyright (C) 2011, Robert D. Cameron 3 Copyright (C) 2011, Robert D. Cameron, Kenneth S. Herdy 4 4 Licensed to the public under the Open Software License 3.0. 5 5 Licensed to International Characters Inc. … … 12 12 #include <stdio.h> 13 13 #include "config.hpp" 14 #include "builtins.hpp" 14 15 #include "idisa.hpp" 15 16 … … 17 18 #define BLOCK_SIZE 128 18 19 #endif 20 21 template<class T> void print_register(const char * var_name, T v); 19 22 20 23 /* Default BLOCK_SIZE is 128, compatible with SSE, Altivec, SPU */ … … 28 31 #endif 29 32 30 /* Wrapper Declarations */ 31 /* 32 #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) 33 #define sisd_srl(blk, n) simd<128>::srl(blk, n) 34 #define sisd_slli(blk, n) simd<128>::slli<n>(blk) 35 #define sisd_srli(blk, n) simd<128>::srli<n>(blk) 36 #define sisd_sfl(blk, n) sisd_sll(blk, n) // TODO  Remove forward (f) and backward (b) do not make sense in a little endian based library, just left and right in a register representation 37 #define sisd_sbl(blk, n) sisd_srl(blk, n) 38 #define sisd_sfli(blk, n) sisd_slli(blk, n) 39 #define sisd_sbli(blk, n) sisd_srli(blk, n) 40 #define sb_op(x, n) ((x)>>(n)) 41 #define sf_op(x, n) ((x)<<(n)) 33 /* Template specialization is slightly slower, but may be required to differentiate on integer types unsigned long and unsigned long long. 34 //template<class block_t> IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes(block_t s); 35 //template<class block_t> IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes(block_t s); 36 template<> IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes<unsigned long>(unsigned long s) {return cfzl(s);} 37 template<> IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes<unsigned long long>(unsigned long long s) {return cfzll(s);} 38 template<> IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes<unsigned long>(unsigned long s) {return cbzl(s);} 39 template<> IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes<unsigned long long>(unsigned long long s) {return cbzll(s);} 42 40 */ 43 41 44 template<class T> void print_register(const char * var_name, T v); // print integer types as array of unsigned char 42 static IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes(unsigned long v) { return cfzl(v);} 43 static IDISA_ALWAYS_INLINE uint32_t count_forward_zeroes(unsigned long long v) { return cfzll(v);} 44 static IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes(unsigned long s) {return cbzl(s);} 45 static IDISA_ALWAYS_INLINE uint32_t count_reverse_zeroes(unsigned long long s) {return cbzll(s);} 45 46 46 /* Debug */47 47 template <class T> 48 48 void print_register(const char * var_name, T v) {
Note: See TracChangeset
for help on using the changeset viewer.