Ignore:
Timestamp:
May 8, 2013, 4:36:24 PM (6 years ago)
Author:
bhull
Message:

RE strategy changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/RE/output/lib/simd-lib/pabloSupport.hpp

    r3005 r3122  
    2424
    2525const BitBlock simd_const_1 = mvmd<BLOCK_SIZE/4>::fill4(0,0,0,1);
     26
     27const BitBlock simd_sign_bit = bitblock::slli<BLOCK_SIZE-1>(simd_const_1);
     28
     29IDISA_ALWAYS_INLINE BitBlock Dequeue_bit(BitBlock & q) {
     30        BitBlock bit = simd_and(q, simd_const_1);
     31        q = simd<64>::srli<1>(q);
     32        return bit;
     33}
    2634
    2735IDISA_ALWAYS_INLINE BitBlock pablo_blk_Advance(BitBlock strm, BitBlock carryin, BitBlock & rslt) {
     
    5260        add_ci_co(marker, charclass, carryin, carryout, sum);
    5361        rslt = simd_andc(sum, charclass);
     62        return carryout;
     63}
     64
     65IDISA_ALWAYS_INLINE BitBlock pablo_blk_MatchStar(BitBlock marker, BitBlock charclass, BitBlock carryin, BitBlock & rslt) {
     66        BitBlock carryout, sum;
     67        add_ci_co(simd_and(charclass, marker), charclass, carryin, carryout, sum);
     68        rslt = simd_or(simd_xor(sum, charclass), marker);
    5469        return carryout;
    5570}
     
    103118}
    104119
    105 
     120template <typename T> IDISA_ALWAYS_INLINE BitBlock pablo_blk_match(T bytedata[], const T match_str[], BitBlock v, int len) {
     121        union {BitBlock bitblock; ScanWord elems[sizeof(BitBlock)/sizeof(ScanWord)];} u;
     122        u.bitblock = v;
     123        int pos;
     124        ScanWord s, t, bit;
     125        for (unsigned int i = 0; i < sizeof(BitBlock)/sizeof(ScanWord); i++) {
     126                s = u.elems[i];
     127                while (s != 0) {
     128                        pos = scan_forward_zeroes(s);
     129                        t = s;
     130                        s = s & (s - 1); // clear rightmost bit
     131                        if (memcmp((void *) &bytedata[pos], (void *) match_str, len * sizeof(T))) {
     132                                // Strings do not match; filter the result.
     133                                bit = s ^ t;
     134                                u.elems[i] ^= bit;
     135                        }
     136                }
     137        }
     138        return u.bitblock;
     139}
    106140
    107141#endif // PABLOSUPPORT_HPP_
Note: See TracChangeset for help on using the changeset viewer.