Changeset 1077 for trunk/lib/carryQ.h


Ignore:
Timestamp:
Apr 8, 2011, 10:16:25 AM (8 years ago)
Author:
cameron
Message:

CarryQ changes for AVX/BitBlock_scantofirst

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/carryQ.h

    r1075 r1077  
    22// carryQ.h
    33// Robert D. Cameron
     4// April 8, 2011 - Merged with AVX version; add BitBlock_scantofirst
    45// Dec. 5, 2010 - first queuing implementation
    56// November 29, 2010 - first version without actual queueing.
    67//
     8
     9#ifdef CARRYQ_AVX
     10#define bitblock_adc adc256
     11#define bitblock_sbb sbb256
     12#define bitblock_advance_with_carry advance_with_carry256
     13#else
     14#define bitblock_adc adc128
     15#define bitblock_sbb sbb128
     16#define bitblock_advance_with_carry advance_with_carry
     17#endif
     18
     19
    720#ifndef CARRY_Q_H
    821#define CARRY_Q_H
     
    7386
    7487#ifndef CARRY_Q
     88#ifdef CARRYQ_AVX
     89#include "block_carry_avx.h"
     90#else
    7591#include "block_carry.h"
    76 
     92#endif
    7793
    7894#define CarryQtype CarryType *
     
    137153static inline BitBlock BitBlock_advance_ci_co(BitBlock strm, CarryQtype cq, const int carryno) {
    138154        BitBlock rslt;
    139         advance_with_carry(strm, cq[carryno], rslt);
     155        bitblock_advance_with_carry(strm, cq[carryno], rslt);
    140156        return rslt;
    141157}
     
    144160        BitBlock rslt;
    145161        cq[carryno] = Carry0;
    146         advance_with_carry(strm, cq[carryno], rslt);
     162        bitblock_advance_with_carry(strm, cq[carryno], rslt);
    147163        return rslt;
    148164}
     
    151167        BitBlock rslt;
    152168        CarryType c = cq[carryno];
    153         advance_with_carry(strm, c, rslt);
     169        bitblock_advance_with_carry(strm, c, rslt);
    154170        return rslt;
    155171}
     
    161177static inline BitBlock BitBlock_add_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, const int carryno) {
    162178        BitBlock sum;
    163         adc128(strm1, strm2, cq[carryno], sum);
     179        bitblock_adc(strm1, strm2, cq[carryno], sum);
    164180        return sum;
    165181}
     
    168184        BitBlock sum;
    169185        cq[carryno] = Carry0;
    170         adc128(strm1, strm2, cq[carryno], sum);
     186        bitblock_adc(strm1, strm2, cq[carryno], sum);
    171187        return sum;
    172188}
     
    175191        BitBlock sum;
    176192        CarryType c = cq[carryno];
    177         adc128(strm1, strm2, c, sum);
     193        bitblock_adc(strm1, strm2, c, sum);
    178194        return sum;
    179195}
     
    182198        BitBlock sum;
    183199        CarryType c = Carry0;
    184         adc128(strm1, strm2, c, sum);
     200        bitblock_adc(strm1, strm2, c, sum);
    185201        return sum;
    186202}
     
    188204static inline BitBlock BitBlock_sub_ci_co(BitBlock strm1, BitBlock strm2, CarryQtype cq, const int carryno) {
    189205        BitBlock diff;
    190         sbb128(strm1, strm2, cq[carryno], diff);
     206        bitblock_sbb(strm1, strm2, cq[carryno], diff);
    191207        return diff;
    192208}
     
    195211        BitBlock diff;
    196212        cq[carryno] = Carry0;
    197         sbb128(strm1, strm2, cq[carryno], diff);
     213        bitblock_sbb(strm1, strm2, cq[carryno], diff);
    198214        return diff;
    199215}
     
    202218        BitBlock diff;
    203219        CarryType c = cq[carryno];
    204         sbb128(strm1, strm2, c, diff);
     220        bitblock_sbb(strm1, strm2, c, diff);
    205221        return diff;
    206222}
     
    209225        BitBlock diff;
    210226        CarryType c = Carry0;
    211         sbb128(strm1, strm2, c, diff);
     227        bitblock_sbb(strm1, strm2, c, diff);
    212228        return diff;
    213229}
     
    215231static inline BitBlock BitBlock_scanthru_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype cq, const int carryno) {
    216232        BitBlock markers1;
    217         adc128(markers0, charclass, cq[carryno], markers1);
     233        bitblock_adc(markers0, charclass, cq[carryno], markers1);
    218234        return simd_andc(markers1, charclass);
    219235}
     
    222238        BitBlock markers1;
    223239        cq[carryno] = Carry0;
    224         adc128(markers0, charclass, cq[carryno], markers1);
     240        bitblock_adc(markers0, charclass, cq[carryno], markers1);
    225241        return simd_andc(markers1, charclass);
    226242}
     
    229245        BitBlock markers1;
    230246        CarryType c = cq[carryno];
    231         adc128(markers0, charclass, c, markers1);
     247        bitblock_adc(markers0, charclass, c, markers1);
    232248        return simd_andc(markers1, charclass);
    233249}
     
    236252        BitBlock markers1;
    237253        CarryType c = Carry0;
    238         adc128(markers0, charclass, c, markers1);
     254        bitblock_adc(markers0, charclass, c, markers1);
    239255        return simd_andc(markers1, charclass);
    240256}
     
    242258static inline BitBlock BitBlock_scanto_ci_co(BitBlock markers0, BitBlock charclass, CarryQtype cq, const int carryno) {
    243259        BitBlock markers1;
    244         adc128(markers0, simd_not(charclass), cq[carryno], markers1);
     260        bitblock_adc(markers0, simd_not(charclass), cq[carryno], markers1);
    245261        return simd_and(markers1, charclass);
    246262}
     
    249265        BitBlock markers1;
    250266        cq[carryno] = Carry0;
    251         adc128(markers0, simd_not(charclass), cq[carryno], markers1);
     267        bitblock_adc(markers0, simd_not(charclass), cq[carryno], markers1);
    252268        return simd_and(markers1, charclass);
    253269}
     
    257273        CarryType c = cq[carryno];
    258274        BitBlock scanclass = simd_andc(EOF_mask, charclass);
    259         adc128(markers0, scanclass, c, markers1);
     275        bitblock_adc(markers0, scanclass, c, markers1);
    260276        return simd_andc(markers1, scanclass);
    261277}
     
    265281        CarryType c = Carry0;
    266282        BitBlock scanclass = simd_andc(EOF_mask, charclass);
    267         adc128(markers0, scanclass, c, markers1);
     283        bitblock_adc(markers0, scanclass, c, markers1);
    268284        return simd_andc(markers1, scanclass);
    269285}
     
    276292        BitBlock marker;
    277293        CarryType c = carry_flip(cq[carryno]);
    278         adc128(simd_const_1(0), simd_not(charclass), c, marker);
     294        bitblock_adc(simd_const_1(0), simd_not(charclass), c, marker);
    279295        cq[carryno] = carry_flip(c);
    280296        return simd_and(marker, charclass);
Note: See TracChangeset for help on using the changeset viewer.