Changeset 457 for proto/parabix2
 Timestamp:
 Jul 10, 2010, 7:39:09 AM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

proto/parabix2/compiled/block_carry.h
r456 r457 11 11 #include "sse_simd.h" 12 12 13 #define ADC _64 113 #define ADC64 1 14 14 #define SIMD_CARRY 2 15 #define CARRY_STRATEGY SIMD_CARRY 16 17 #if (CARRY_STRATEGY == ADC_64) 15 #define ADC64_SAHF 3 16 17 #define CARRY_STRATEGY ADC64_SAHF 18 19 #if (CARRY_STRATEGY == ADC64) 20 typedef uint64_t CarryType; 21 22 #define Carry0 0 23 24 #define test_carry(x) ((x) > 0) 25 26 #define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \ 27 __asm__ ("add %[carryflag], %[e1]\n\t" \ 28 "adc %[e1], %[z1]\n\t" \ 29 "adc %[e2], %[z2]\n\t" \ 30 "mov $0, %[carryflag]\n\t" \ 31 "adc $0, %[carryflag]\n\t" \ 32 : [z1] "=r" (rslt1), [z2] "=r" (rslt2), [carryflag] "=r" (carry) \ 33 : "[z1]" (x1), "[z2]" (x2), \ 34 [e1] "r" (y1), [e2] "r" (y2), \ 35 "[carryflag]" (carry) \ 36 : "cc") 37 38 #define adc128(first, second, carry, sum) \ 39 do\ 40 {\ 41 union {__m128i bitblock;\ 42 uint64_t int64[2];} rslt;\ 43 \ 44 union {__m128i bitblock;\ 45 uint64_t int64[2];} x;\ 46 \ 47 union {__m128i bitblock;\ 48 uint64_t int64[2];} y;\ 49 \ 50 x.bitblock = first;\ 51 y.bitblock = second;\ 52 \ 53 double_int64_adc(x.int64[0], x.int64[1], y.int64[0], y.int64[1], rslt.int64[0], rslt.int64[1], carry);\ 54 sum = rslt.bitblock;\ 55 }while(0) 56 57 58 59 #define advance_with_carry(cursor, carry, rslt)\ 60 adc128(cursor, cursor, carry, rslt) 61 62 63 #define double_int64_sbb(x1, x2, y1, y2, rslt1, rslt2, carry) \ 64 __asm__ ("sahf\n\t" \ 65 "sbb %[e1], %[z1]\n\t" \ 66 "sbb %[e2], %[z2]\n\t" \ 67 "lahf\n\t" \ 68 : [z1] "=r" (rslt1), [z2] "=r" (rslt2), [carryflag] "=a" (carry) \ 69 : "[z1]" (x1), "[z2]" (x2), \ 70 [e1] "r" (y1), [e2] "r" (y2), \ 71 "[carryflag]" (carry) \ 72 : "cc") 73 74 #define sbb128(first, second, carry, sum) \ 75 do\ 76 { union {__m128i bitblock;\ 77 uint64_t int64[2];} rslt;\ 78 \ 79 union {__m128i bitblock;\ 80 uint64_t int64[2];} x;\ 81 \ 82 union {__m128i bitblock;\ 83 uint64_t int64[2];} y;\ 84 \ 85 x.bitblock = first;\ 86 y.bitblock = second;\ 87 \ 88 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;\ 91 }while(0) 92 93 #endif 94 95 #if (CARRY_STRATEGY == ADC64_SAHF) 18 96 typedef uint64_t CarryType; 19 97 … … 89 167 90 168 #endif 169 170 91 171 92 172 #if (CARRY_STRATEGY == SIMD_CARRY)
Note: See TracChangeset
for help on using the changeset viewer.