source: trunk/lib/pabloSupport.hpp @ 2610

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

Add support for new carry code gen objects in Pablo compiler

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