source: trunk/lib/pabloSupport.hpp @ 2694

Last change on this file since 2694 was 2694, checked in by cameron, 6 years ago

Macros for use by Pablo CCGOs

File size: 2.5 KB
Line 
1#ifndef PABLOSUPPORT_HPP_
2#define PABLOSUPPORT_HPP_
3
4
5#include "bitblock.hpp"
6
7
8#define BitBlock_declare(name)  BitBlock name
9
10#define ubitblock_declare(name, n) ubitblock name[n]
11
12
13IDISA_ALWAYS_INLINE BitBlock pablo_blk_Advance(BitBlock strm, BitBlock carryin, BitBlock & rslt) {
14        BitBlock carryout;
15        adv_ci_co(strm, carryin, carryout, rslt);
16        return carryout;
17}
18
19IDISA_ALWAYS_INLINE BitBlock pablo_blk_ScanThru(BitBlock marker, BitBlock charclass, BitBlock carryin, BitBlock & rslt) {
20        BitBlock carryout, sum;
21        add_ci_co(marker, charclass, carryin, carryout, sum);
22        rslt = simd_andc(sum, charclass);
23        return carryout;
24}
25
26IDISA_ALWAYS_INLINE BitBlock pablo_blk_AdvanceThenScanThru(BitBlock marker, BitBlock charclass, BitBlock carryin, BitBlock & rslt) {
27        BitBlock carryout, sum;
28        add_ci_co(marker, simd_or(charclass, marker), carryin, carryout, sum);
29        rslt = simd_andc(sum, charclass);
30        return carryout;
31}
32
33IDISA_ALWAYS_INLINE BitBlock pablo_blk_ScanTo(BitBlock marker, BitBlock charclass, BitBlock carryin, BitBlock & rslt) {
34        BitBlock carryout, sum;
35        add_ci_co(marker, simd_not(charclass), carryin, carryout, sum);
36        rslt = simd_and(sum, charclass);
37        return carryout;
38}
39
40IDISA_ALWAYS_INLINE BitBlock pablo_blk_AdvanceThenScanTo(BitBlock marker, BitBlock charclass, BitBlock carryin, BitBlock & rslt) {
41        BitBlock carryout, sum;
42        add_ci_co(marker, simd_or(marker, simd_not(charclass)), carryin, carryout, sum);
43        rslt = simd_and(sum, charclass);
44        return carryout;
45}
46
47IDISA_ALWAYS_INLINE BitBlock pablo_blk_ScanToFirst(BitBlock charclass, BitBlock carryin, BitBlock & rslt) {
48        BitBlock carryout, sum;
49        add_ci_co(simd<BLOCK_SIZE>::constant<0>(), simd_not(charclass), carryin, carryout, sum);
50        rslt = simd_and(sum, charclass);
51        return carryout;
52}
53
54IDISA_ALWAYS_INLINE BitBlock pablo_blk_SpanUpTo(BitBlock starts, BitBlock follows, BitBlock carryin, BitBlock & rslt) {
55        BitBlock carryout;
56        sub_bi_bo(follows, starts, carryin, carryout, rslt);
57        return carryout;
58}
59
60IDISA_ALWAYS_INLINE BitBlock pablo_blk_InclusiveSpan(BitBlock starts, BitBlock follows, BitBlock carryin, BitBlock & rslt) {
61        BitBlock carryout, span;
62        sub_bi_bo(follows, starts, carryin, carryout, span);
63        rslt = simd_or(span, follows);
64        return carryout;
65}
66
67IDISA_ALWAYS_INLINE BitBlock pablo_blk_ExclusiveSpan(BitBlock starts, BitBlock follows, BitBlock carryin, BitBlock & rslt) {
68        BitBlock carryout, span;
69        sub_bi_bo(follows, starts, carryin, carryout, span);
70        rslt = simd_andc(span, starts);
71        return carryout;
72}
73
74
75
76#endif // PABLOSUPPORT_HPP_
Note: See TracBrowser for help on using the repository browser.