Changeset 930 for trunk/lib


Ignore:
Timestamp:
Mar 10, 2011, 9:24:11 PM (8 years ago)
Author:
cameron
Message:

Reorganize; add BitBlock_scanto... routines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/carryQ.h

    r929 r930  
    55// November 29, 2010 - first version without actual queueing.
    66//
     7#ifndef CARRY_Q_H
     8#define CARRY_Q_H
     9
    710#ifdef SIMD_CARRY_Q
    811#define CARRY_Q
    9 #endif
     12#define CarryQtype SIMD_type
     13#endif
     14
    1015#ifdef ADC64_CARRY_Q
    1116#define CARRY_Q
     17#define CarryQtype uint64_t
     18#endif
     19
     20#ifdef CARRY_Q
     21static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     22
     23static inline BitBlock BitBlock_advance_ci(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     24
     25static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     26
     27static inline BitBlock BitBlock_advance(BitBlock strm) __attribute__ ((always_inline));
     28
     29static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     30
     31static inline BitBlock BitBlock_add_ci(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     32
     33static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     34
     35static inline BitBlock BitBlock_add(BitBlock strm1, BitBlock strm2) __attribute__ ((always_inline));
     36
     37static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     38
     39static inline BitBlock BitBlock_sub_ci(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     40
     41static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     42
     43static inline BitBlock BitBlock_sub(BitBlock strm1, BitBlock strm2) __attribute__ ((always_inline));
     44
     45static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     46
     47static inline BitBlock BitBlock_scanthru_ci(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     48
     49static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     50
     51static inline BitBlock BitBlock_scanthru(BitBlock markers0, BitBlock charclass) __attribute__ ((always_inline));
     52
     53static inline BitBlock BitBlock_scanto_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     54
     55static inline BitBlock BitBlock_scanto_ci(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     56
     57static inline BitBlock BitBlock_scanto_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
     58
     59static inline BitBlock BitBlock_scanto(BitBlock markers0, BitBlock charclass) __attribute__ ((always_inline));
     60
     61static inline bool CarryTest(CarryQtype & cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
     62
     63static inline void CarryDequeueEnqueue(CarryQtype & cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
     64
     65static inline void CarryQ_Adjust(CarryQtype & cq, const int carry_count) __attribute__ ((always_inline));
     66
     67static inline void CarryCombine(CarryQtype & cq, CarryQtype & local_cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
     68
    1269#endif
    1370
     
    56113
    57114static inline BitBlock BitBlock_scanthru(BitBlock markers0, BitBlock charclass) __attribute__ ((always_inline));
     115
     116static inline BitBlock BitBlock_scanto_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype cq, const int carryno) __attribute__ ((always_inline));
     117
     118static inline BitBlock BitBlock_scanto_ci(BitBlock markers0, BitBlock charclass, CarryQtype cq, const int carryno) __attribute__ ((always_inline));
     119
     120static inline BitBlock BitBlock_scanto_co(BitBlock markers0, BitBlock charclass, CarryQtype cq, const int carryno) __attribute__ ((always_inline));
     121
     122static inline BitBlock BitBlock_scanto(BitBlock markers0, BitBlock charclass) __attribute__ ((always_inline));
    58123
    59124static inline bool CarryTest(CarryQtype cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
     
    149214#ifdef SIMD_CARRY_Q
    150215
    151 #define CarryQtype SIMD_type
    152 
    153216#define CarryDeclare(name, count)\
    154217  CarryQtype name
     
    159222SIMD_type carryQ_ci_mask = sisd_from_int(1);
    160223SIMD_type carryQ_co_mask = sisd_slli(carryQ_ci_mask, 127);
    161 
    162 static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    163 
    164 static inline BitBlock BitBlock_advance_ci(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    165 
    166 static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    167 
    168 static inline BitBlock BitBlock_advance(BitBlock strm) __attribute__ ((always_inline));
    169 
    170 static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    171 
    172 static inline BitBlock BitBlock_add_ci(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    173 
    174 static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    175 
    176 static inline BitBlock BitBlock_add(BitBlock strm1, BitBlock strm2) __attribute__ ((always_inline));
    177 
    178 static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    179 
    180 static inline BitBlock BitBlock_sub_ci(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    181 
    182 static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    183 
    184 static inline BitBlock BitBlock_sub(BitBlock strm1, BitBlock strm2) __attribute__ ((always_inline));
    185 
    186 static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    187 
    188 static inline BitBlock BitBlock_scanthru_ci(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    189 
    190 static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    191 
    192 static inline BitBlock BitBlock_scanthru(BitBlock markers0, BitBlock charclass) __attribute__ ((always_inline));
    193 
    194 static inline bool CarryTest(CarryQtype & cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
    195 
    196 static inline void CarryDequeueEnqueue(CarryQtype & cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
    197 
    198 static inline void CarryQ_Adjust(CarryQtype & cq, const int carry_count) __attribute__ ((always_inline));
    199 
    200 static inline void CarryCombine(CarryQtype & cq, CarryQtype & local_cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
    201224
    202225static inline BitBlock BitBlock_advance_ci_co(BitBlock cursor, CarryQtype & carryQ, const int carryno) {
     
    381404//     by the dequeue operation.
    382405
    383 #define CarryQtype uint64_t
    384 
    385406#define CarryDeclare(name, count)\
    386407CarryQtype name
     
    390411
    391412typedef union {SIMD_type bitblock; uint64_t int64[2];} BitBlock_int64;
    392 
    393 static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    394 
    395 static inline BitBlock BitBlock_advance_ci(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    396 
    397 static inline BitBlock BitBlock_advance_co(BitBlock strm, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    398 
    399 static inline BitBlock BitBlock_advance(BitBlock strm) __attribute__ ((always_inline));
    400 
    401 static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    402 
    403 static inline BitBlock BitBlock_add_ci(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    404 
    405 static inline BitBlock BitBlock_add_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    406 
    407 static inline BitBlock BitBlock_add(BitBlock strm1, BitBlock strm2) __attribute__ ((always_inline));
    408 
    409 static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    410 
    411 static inline BitBlock BitBlock_sub_ci(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    412 
    413 static inline BitBlock BitBlock_sub_co(BitBlock strm1, BitBlock strm2, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    414 
    415 static inline BitBlock BitBlock_sub(BitBlock strm1, BitBlock strm2) __attribute__ ((always_inline));
    416 
    417 static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    418 
    419 static inline BitBlock BitBlock_scanthru_ci(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    420 
    421 static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) __attribute__ ((always_inline));
    422 
    423 static inline BitBlock BitBlock_scanthru(BitBlock markers0, BitBlock charclass) __attribute__ ((always_inline));
    424 
    425 static inline bool CarryTest(CarryQtype & cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
    426 
    427 static inline void CarryDequeueEnqueue(CarryQtype & cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
    428 
    429 static inline void CarryQ_Adjust(CarryQtype & cq, const int carry_count) __attribute__ ((always_inline));
    430 
    431 static inline void CarryCombine(CarryQtype & cq, CarryQtype & local_cq, const int carryno, const int carry_count) __attribute__ ((always_inline));
    432413
    433414
     
    611592
    612593
    613 static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
    614         return simd_andc(BitBlock_add_ci_co(markers0, charclass, cq, carryno), charclass);
    615 }
    616 
    617 static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
    618         return simd_andc(BitBlock_add_co(markers0, charclass, cq, carryno), charclass);
    619 }
    620 
    621 static inline BitBlock BitBlock_scanthru_ci(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
    622         return simd_andc(BitBlock_add_ci(markers0, charclass, cq, carryno), charclass);
    623 }
    624 
    625 static inline BitBlock BitBlock_scanthru(BitBlock markers0, BitBlock charclass) {
    626         return simd_andc(BitBlock_add(markers0, charclass), charclass);
    627 }
    628594
    629595static inline bool CarryTest(CarryQtype & cq, const int carryno, const int carry_count) {
     
    650616
    651617#endif
     618
     619#ifdef CARRY_Q
     620static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
     621        return simd_andc(BitBlock_add_ci_co(markers0, charclass, cq, carryno), charclass);
     622}
     623
     624static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
     625        return simd_andc(BitBlock_add_co(markers0, charclass, cq, carryno), charclass);
     626}
     627
     628static inline BitBlock BitBlock_scanthru_ci(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
     629        return simd_andc(BitBlock_add_ci(markers0, charclass, cq, carryno), charclass);
     630}
     631
     632static inline BitBlock BitBlock_scanthru(BitBlock markers0, BitBlock charclass) {
     633        return simd_andc(BitBlock_add(markers0, charclass), charclass);
     634}
     635
     636static inline BitBlock BitBlock_scanto_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
     637        return simd_and(BitBlock_add_ci_co(markers0, simd_not(charclass), cq, carryno), charclass);
     638}
     639
     640static inline BitBlock BitBlock_scanthru_co(BitBlock markers0, BitBlock charclass, CarryQtype & cq, const int carryno) {
     641        return simd_and(BitBlock_add_co(markers0, simd_not(charclass), cq, carryno), charclass);
     642}
     643
     644static inline BitBlock BitBlock_scanthru_ci(BitBlock markers0, BitBlock charclass, BitBlock EOF_mask, CarryQtype & cq, const int carryno) {
     645        return simd_and(BitBlock_add_ci(markers0, simd_and(simd_not(charclass), EOF_mask), cq, carryno), charclass);
     646}
     647
     648static inline BitBlock BitBlock_scanthru(BitBlock markers0, BitBlock charclass, BitBlock EOF_mask) {
     649        return simd_and(BitBlock_add(markers0, simd_and(simd_not(charclass)), EOF_mask), charclass);
     650}
     651
     652
     653#endif
     654
     655#endif
     656
Note: See TracChangeset for help on using the changeset viewer.