Changeset 390 for proto/Compiler
 Timestamp:
 Apr 30, 2010, 6:12:01 PM (9 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

proto/Compiler/template.c
r365 r390 50 50 #define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \ 51 51 __asm__ ("sahf\n\t" \ 52 53 54 55 : [z1] "=r" (rslt1), [z2] "=r" (rslt2), [carry] "=a" (carry) \52 "adc %[e1], %[z1]\n\t" \ 53 "adc %[e2], %[z2]\n\t" \ 54 "lahf\n\t" \ 55 : [z1] "=r" (rslt1), [z2] "=r" (rslt2), [carryflag] "=a" (carry) \ 56 56 : "[z1]" (x1), "[z2]" (x2), \ 57 57 [e1] "r" (y1), [e2] "r" (y2), \ 58 "[carry ]" (carry) \58 "[carryflag]" (carry) \ 59 59 : "cc") 60 60 61 static inline BitBlock adc128(BitBlock first, BitBlock second, int &carry) 62 { 63 union {__m128i bitblock; 64 uint64_t int64[2];} rslt; 65 66 union {__m128i bitblock; 67 uint64_t int64[2];} x; 68 69 union {__m128i bitblock; 70 uint64_t int64[2];} y; 71 72 x.bitblock = first; 73 y.bitblock = second; 74 75 double_int64_adc(x.int64[0], x.int64[1], y.int64[0], y.int64[1], 76 rslt.int64[0], rslt.int64[1], carry); 77 78 return rslt.bitblock; 79 } 61 #define adc128(first, second, carry, sum) \ 62 do\ 63 {\ 64 union {__m128i bitblock;\ 65 uint64_t int64[2];} rslt;\ 66 \ 67 union {__m128i bitblock;\ 68 uint64_t int64[2];} x;\ 69 \ 70 union {__m128i bitblock;\ 71 uint64_t int64[2];} y;\ 72 \ 73 x.bitblock = first;\ 74 y.bitblock = second;\ 75 \ 76 double_int64_adc(x.int64[0], x.int64[1], y.int64[0], y.int64[1], rslt.int64[0], rslt.int64[1], carry);\ 77 sum = rslt.bitblock;\ 78 }while(0) 80 79 81 80 82 81 83 82 #define double_int64_sbb(x1, x2, y1, y2, rslt1, rslt2, carry) \ 84 83 __asm__ ("sahf\n\t" \ 85 86 87 88 : [z1] "=r" (rslt1), [z2] "=r" (rslt2), [carry] "=a" (carry) \84 "sbb %[e1], %[z1]\n\t" \ 85 "sbb %[e2], %[z2]\n\t" \ 86 "lahf\n\t" \ 87 : [z1] "=r" (rslt1), [z2] "=r" (rslt2), [carryflag] "=a" (carry) \ 89 88 : "[z1]" (x1), "[z2]" (x2), \ 90 89 [e1] "r" (y1), [e2] "r" (y2), \ 91 "[carry ]" (carry) \90 "[carryflag]" (carry) \ 92 91 : "cc") 93 92 94 static inline BitBlock sbb128(BitBlock first, BitBlock second, int &carry) 95 { 96 union {__m128i bitblock; 97 uint64_t int64[2];} rslt; 98 99 union {__m128i bitblock; 100 uint64_t int64[2];} x; 101 102 union {__m128i bitblock; 103 uint64_t int64[2];} y; 104 105 x.bitblock = first; 106 y.bitblock = second; 107 108 double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], 109 rslt.int64[0], rslt.int64[1], carry); 110 111 return rslt.bitblock; 112 } 113 93 #define sbb128(first, second, carry, sum) \ 94 do\ 95 { union {__m128i bitblock;\ 96 uint64_t int64[2];} rslt;\ 97 \ 98 union {__m128i bitblock;\ 99 uint64_t int64[2];} x;\ 100 \ 101 union {__m128i bitblock;\ 102 uint64_t int64[2];} y;\ 103 \ 104 x.bitblock = first;\ 105 y.bitblock = second;\ 106 \ 107 double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], \ 108 rslt.int64[0], rslt.int64[1], carry);\ 109 sum = rslt.bitblock;\ 110 }while(0) 114 111 115 112
Note: See TracChangeset
for help on using the changeset viewer.