Changeset 459 for proto/parabix2
 Timestamp:
 Jul 10, 2010, 12:25:01 PM (9 years ago)
 Location:
 proto/parabix2/compiled
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

proto/parabix2/compiled/block_carry.h
r457 r459 4 4 Licensed to International Characters Inc. 5 5 under the Academic Free License version 3.0. 6 7 This file defines addition, subtract and shift operations on 8 128bit blocks. Different versions of the operations are 9 selectable with the CARRY_STRATEGY preprocessor constant. 10 11 Each implementation defines the following "abstract data type" 12 for block operations with carry. 13 14 Typename: CarryType 15 Constant: Carry0 represents a value of 0 for the carry bit. 16 Predicate: test_carry(x) returns nonzero if a carry bit is 1, 0 otherwise. 17 Function: carry_or(carry1, carry2) forms the logical or of two carries. 18 Function: adc128(x, y, carry, sum) computes (carry, sum) = x + y + carry, 19 Function: advance_with_carry(cursor, carry, rslt) 20 computes (carry, rslt) = cursor + cursor + carry 21 Function: sbb128(x, y, borrow, diff) 22 computes (borrow, diff) = y  x  borrow 23 6 24 */ 7 25 #ifndef BLOCK_CARRY_H 8 26 #define BLOCK_CARRY_H 9 27 28 29 30 31 10 32 /**/ 11 33 #include "sse_simd.h" … … 23 45 24 46 #define test_carry(x) ((x) > 0) 47 48 #define carry_or(carry1, carry2) (carry1  carry2) 25 49 26 50 #define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \ … … 72 96 : "cc") 73 97 74 #define sbb128(first, second, carry, sum) \98 #define sbb128(first, second, borrow, diff) \ 75 99 do\ 76 100 { union {__m128i bitblock;\ … … 87 111 \ 88 112 double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], \ 89 rslt.int64[0], rslt.int64[1], carry);\90 sum= rslt.bitblock;\113 rslt.int64[0], rslt.int64[1], borrow);\ 114 diff = rslt.bitblock;\ 91 115 }while(0) 92 116 … … 99 123 100 124 #define test_carry(x) (((x)&256) > 0) 125 126 #define carry_or(carry1, carry2) (carry1  carry2) 101 127 102 128 #define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \ … … 147 173 : "cc") 148 174 149 #define sbb128(first, second, carry, sum) \175 #define sbb128(first, second, borrow, diff) \ 150 176 do\ 151 177 { union {__m128i bitblock;\ … … 162 188 \ 163 189 double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], \ 164 rslt.int64[0], rslt.int64[1], carry);\165 sum= rslt.bitblock;\190 rslt.int64[0], rslt.int64[1], borrow);\ 191 diff = rslt.bitblock;\ 166 192 }while(0) 167 193 … … 177 203 178 204 #define test_carry(x) bitblock_has_bit(x) 205 206 #define carry_or(carry1, carry2) simd_or(carry1, carry2) 179 207 180 208 #define adc128(x, y, carry, sum) \ 
proto/parabix2/compiled/sse_simd.h
r453 r459 17 17 #define BIG_ENDIAN 4321 18 18 #define BYTE_ORDER LITTLE_ENDIAN 19 #endif 19 #define inline __inline 20 #endif 21 20 22 #include <limits.h> 21 23 #ifndef LONG_BIT 22 #define LONG_BIT (8*__WORDSIZE) 23 #endif 24 #if ULONG_MAX == 0xFFFFFFFF 25 #define LONG_BIT 32 26 #endif 27 #if ULONG_MAX == 0xFFFFFFFFFFFFFFFF 28 #define LONG_BIT 64 29 #endif 30 #endif 31 24 32 #include <emmintrin.h> 25 33 #ifdef USE_LDDQU … … 44 52 45 53 /* Specific constants. */ 46 #define simd_himask_2 _mm_set1_epi 8(0xAA)47 #define simd_himask_4 _mm_set1_epi 8(0xCC)48 #define simd_himask_8 _mm_set1_epi 8(0xF0)54 #define simd_himask_2 _mm_set1_epi32(0xAAAAAAAA) 55 #define simd_himask_4 _mm_set1_epi32(0xCCCCCCCC) 56 #define simd_himask_8 _mm_set1_epi32(0xF0F0F0F0) 49 57 /* Littleendian */ 50 #define simd_himask_16 _mm_set1_epi 16(0xFF00)58 #define simd_himask_16 _mm_set1_epi32(0xFF00FF00) 51 59 #define simd_himask_32 _mm_set1_epi32(0xFFFF0000) 52 60 #define simd_himask_64 _mm_set_epi32(1,0,1,0) … … 134 142 #define simd_const_8(n) _mm_set1_epi8(n) 135 143 #define simd_const_4(n) _mm_set1_epi8((n)<<4(n)) 136 #define simd_const_2(n) simd_const_4( n<<2n)144 #define simd_const_2(n) simd_const_4((n)<<2n) 137 145 #define simd_const_1(n) \ 138 146 (n==0 ? simd_const_8(0): simd_const_8(1)) 
proto/parabix2/compiled/template.c
r453 r459 145 145 array_bit__0_,array_bit__1_,array_bit__2_,array_bit__3_,array_bit__4_,array_bit__5_,array_bit__6_,array_bit__7_); 146 146 147 array_bit__0_ &= EOF_mask;148 array_bit__1_ &= EOF_mask;149 array_bit__2_ &= EOF_mask;150 array_bit__3_ &= EOF_mask;151 array_bit__4_ &= EOF_mask;152 array_bit__5_ &= EOF_mask;153 array_bit__6_ &= EOF_mask;154 array_bit__7_ &= EOF_mask;147 array_bit__0_ = simd_and(array_bit__0_, EOF_mask); 148 array_bit__1_ = simd_and(array_bit__1_, EOF_mask); 149 array_bit__2_ = simd_and(array_bit__2_, EOF_mask); 150 array_bit__3_ = simd_and(array_bit__3_, EOF_mask); 151 array_bit__4_ = simd_and(array_bit__4_, EOF_mask); 152 array_bit__5_ = simd_and(array_bit__5_, EOF_mask); 153 array_bit__6_ = simd_and(array_bit__6_, EOF_mask); 154 array_bit__7_ = simd_and(array_bit__7_, EOF_mask); 155 155 156 156 @block_stmts
Note: See TracChangeset
for help on using the changeset viewer.