[383] | 1 | |
---|
| 2 | |
---|
| 3 | typedef SIMD_type BytePack; |
---|
| 4 | typedef SIMD_type BitBlock; |
---|
| 5 | #define min(x,y) ((x) <(y) ?(x) :(y) ) |
---|
| 6 | #define LAHF_CARRY 0x100 |
---|
| 7 | |
---|
| 8 | #define s2p_step(s0,s1,hi_mask,shift,p0,p1) \ |
---|
| 9 | { \ |
---|
| 10 | BitBlock t0,t1; \ |
---|
| 11 | t0= simd_pack_16_hh(s0,s1) ; \ |
---|
| 12 | t1= simd_pack_16_ll(s0,s1) ; \ |
---|
| 13 | p0= simd_if(hi_mask,t0,simd_srli_16(t1,shift) ) ; \ |
---|
| 14 | p1= simd_if(hi_mask,simd_slli_16(t0,shift) ,t1) ; \ |
---|
| 15 | } \ |
---|
| 16 | |
---|
| 17 | #define s2p_bytepack(s0,s1,s2,s3,s4,s5,s6,s7,p0,p1,p2,p3,p4,p5,p6,p7) \ |
---|
| 18 | {BitBlock bit00224466_0,bit00224466_1,bit00224466_2,bit00224466_3; \ |
---|
| 19 | BitBlock bit11335577_0,bit11335577_1,bit11335577_2,bit11335577_3; \ |
---|
| 20 | BitBlock bit00004444_0,bit22226666_0,bit00004444_1,bit22226666_1; \ |
---|
| 21 | BitBlock bit11115555_0,bit33337777_0,bit11115555_1,bit33337777_1; \ |
---|
| 22 | s2p_step(s0,s1,simd_himask_2,1,bit00224466_0,bit11335577_0) \ |
---|
| 23 | s2p_step(s2,s3,simd_himask_2,1,bit00224466_1,bit11335577_1) \ |
---|
| 24 | s2p_step(s4,s5,simd_himask_2,1,bit00224466_2,bit11335577_2) \ |
---|
| 25 | s2p_step(s6,s7,simd_himask_2,1,bit00224466_3,bit11335577_3) \ |
---|
| 26 | s2p_step(bit00224466_0,bit00224466_1,simd_himask_4,2,bit00004444_0,bit22226666_0) \ |
---|
| 27 | s2p_step(bit00224466_2,bit00224466_3,simd_himask_4,2,bit00004444_1,bit22226666_1) \ |
---|
| 28 | s2p_step(bit11335577_0,bit11335577_1,simd_himask_4,2,bit11115555_0,bit33337777_0) \ |
---|
| 29 | s2p_step(bit11335577_2,bit11335577_3,simd_himask_4,2,bit11115555_1,bit33337777_1) \ |
---|
| 30 | s2p_step(bit00004444_0,bit00004444_1,simd_himask_8,4,p0,p4) \ |
---|
| 31 | s2p_step(bit11115555_0,bit11115555_1,simd_himask_8,4,p1,p5) \ |
---|
| 32 | s2p_step(bit22226666_0,bit22226666_1,simd_himask_8,4,p2,p6) \ |
---|
| 33 | s2p_step(bit33337777_0,bit33337777_1,simd_himask_8,4,p3,p7) \ |
---|
| 34 | } \ |
---|
| 35 | |
---|
| 36 | #define p2s_step(p0,p1,hi_mask,shift,s0,s1) \ |
---|
| 37 | { \ |
---|
| 38 | BitBlock t0,t1; \ |
---|
| 39 | t0= simd_if(hi_mask,p0,simd_srli_16(p1,shift) ) ; \ |
---|
| 40 | t1= simd_if(hi_mask,simd_slli_16(p0,shift) ,p1) ; \ |
---|
| 41 | s0= simd_mergeh_8(t0,t1) ; \ |
---|
| 42 | s1= simd_mergel_8(t0,t1) ; \ |
---|
| 43 | } \ |
---|
| 44 | |
---|
| 45 | #define p2s_bytemerge(p0,p1,p2,p3,p4,p5,p6,p7,s0,s1,s2,s3,s4,s5,s6,s7) \ |
---|
| 46 | { \ |
---|
| 47 | BitBlock bit00004444_0,bit22226666_0,bit00004444_1,bit22226666_1; \ |
---|
| 48 | BitBlock bit11115555_0,bit33337777_0,bit11115555_1,bit33337777_1; \ |
---|
| 49 | BitBlock bit00224466_0,bit00224466_1,bit00224466_2,bit00224466_3; \ |
---|
| 50 | BitBlock bit11335577_0,bit11335577_1,bit11335577_2,bit11335577_3; \ |
---|
| 51 | p2s_step(p0,p4,simd_himask_8,4,bit00004444_0,bit00004444_1) \ |
---|
| 52 | p2s_step(p1,p5,simd_himask_8,4,bit11115555_0,bit11115555_1) \ |
---|
| 53 | p2s_step(p2,p6,simd_himask_8,4,bit22226666_0,bit22226666_1) \ |
---|
| 54 | p2s_step(p3,p7,simd_himask_8,4,bit33337777_0,bit33337777_1) \ |
---|
| 55 | p2s_step(bit00004444_0,bit22226666_0,simd_himask_4,2,bit00224466_0,bit00224466_1) \ |
---|
| 56 | p2s_step(bit11115555_0,bit33337777_0,simd_himask_4,2,bit11335577_0,bit11335577_1) \ |
---|
| 57 | p2s_step(bit00004444_1,bit22226666_1,simd_himask_4,2,bit00224466_2,bit00224466_3) \ |
---|
| 58 | p2s_step(bit11115555_1,bit33337777_1,simd_himask_4,2,bit11335577_2,bit11335577_3) \ |
---|
| 59 | p2s_step(bit00224466_0,bit11335577_0,simd_himask_2,1,s0,s1) \ |
---|
| 60 | p2s_step(bit00224466_1,bit11335577_1,simd_himask_2,1,s2,s3) \ |
---|
| 61 | p2s_step(bit00224466_2,bit11335577_2,simd_himask_2,1,s4,s5) \ |
---|
| 62 | p2s_step(bit00224466_3,bit11335577_3,simd_himask_2,1,s6,s7) \ |
---|
| 63 | } \ |
---|
| 64 | |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | #define double_int64_adc(x1, x2, y1, y2, rslt1, rslt2, carry) \ |
---|
| 69 | __asm__ ("sahf\n\t" \ |
---|
| 70 | "adc %[e1], %[z1]\n\t" \ |
---|
| 71 | "adc %[e2], %[z2]\n\t" \ |
---|
| 72 | "lahf\n\t" \ |
---|
| 73 | : [z1] "=r" (rslt1), [z2] "=r" (rslt2), [carryflag] "=a" (carry) \ |
---|
| 74 | : "[z1]" (x1), "[z2]" (x2), \ |
---|
| 75 | [e1] "r" (y1), [e2] "r" (y2), \ |
---|
| 76 | "[carryflag]" (carry) \ |
---|
| 77 | : "cc") |
---|
| 78 | |
---|
| 79 | #define adc128(first, second, carry, sum) \ |
---|
| 80 | do\ |
---|
| 81 | {\ |
---|
| 82 | union {__m128i bitblock;\ |
---|
| 83 | uint64_t int64[2];} rslt;\ |
---|
| 84 | \ |
---|
| 85 | union {__m128i bitblock;\ |
---|
| 86 | uint64_t int64[2];} x;\ |
---|
| 87 | \ |
---|
| 88 | union {__m128i bitblock;\ |
---|
| 89 | uint64_t int64[2];} y;\ |
---|
| 90 | \ |
---|
| 91 | x.bitblock = first;\ |
---|
| 92 | y.bitblock = second;\ |
---|
| 93 | \ |
---|
| 94 | double_int64_adc(x.int64[0], x.int64[1], y.int64[0], y.int64[1], rslt.int64[0], rslt.int64[1], carry);\ |
---|
| 95 | sum = rslt.bitblock;\ |
---|
| 96 | }while(0) |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | /*static inline BitBlock adc128(BitBlock first, BitBlock second, int &carry) |
---|
| 100 | { |
---|
| 101 | union {__m128i bitblock; |
---|
| 102 | uint64_t int64[2];} rslt; |
---|
| 103 | |
---|
| 104 | union {__m128i bitblock; |
---|
| 105 | uint64_t int64[2];} x; |
---|
| 106 | |
---|
| 107 | union {__m128i bitblock; |
---|
| 108 | uint64_t int64[2];} y; |
---|
| 109 | |
---|
| 110 | x.bitblock = first; |
---|
| 111 | y.bitblock = second; |
---|
| 112 | |
---|
| 113 | double_int64_adc(x.int64[0], x.int64[1], y.int64[0], y.int64[1], |
---|
| 114 | rslt.int64[0], rslt.int64[1], carry); |
---|
| 115 | |
---|
| 116 | return rslt.bitblock; |
---|
| 117 | }*/ |
---|
| 118 | |
---|
| 119 | #define double_int64_sbb(x1, x2, y1, y2, rslt1, rslt2, carry) \ |
---|
| 120 | __asm__ ("sahf\n\t" \ |
---|
| 121 | "sbb %[e1], %[z1]\n\t" \ |
---|
| 122 | "sbb %[e2], %[z2]\n\t" \ |
---|
| 123 | "lahf\n\t" \ |
---|
| 124 | : [z1] "=r" (rslt1), [z2] "=r" (rslt2), [carryflag] "=a" (carry) \ |
---|
| 125 | : "[z1]" (x1), "[z2]" (x2), \ |
---|
| 126 | [e1] "r" (y1), [e2] "r" (y2), \ |
---|
| 127 | "[carryflag]" (carry) \ |
---|
| 128 | : "cc") |
---|
| 129 | |
---|
| 130 | /*static inline BitBlock sbb128(BitBlock first, BitBlock second, int &carry) |
---|
| 131 | { |
---|
| 132 | union {__m128i bitblock; |
---|
| 133 | uint64_t int64[2];} rslt; |
---|
| 134 | |
---|
| 135 | union {__m128i bitblock; |
---|
| 136 | uint64_t int64[2];} x; |
---|
| 137 | |
---|
| 138 | union {__m128i bitblock; |
---|
| 139 | uint64_t int64[2];} y; |
---|
| 140 | |
---|
| 141 | x.bitblock = first; |
---|
| 142 | y.bitblock = second; |
---|
| 143 | |
---|
| 144 | double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], |
---|
| 145 | rslt.int64[0], rslt.int64[1], carry); |
---|
| 146 | |
---|
| 147 | return rslt.bitblock; |
---|
| 148 | }*/ |
---|
| 149 | |
---|
| 150 | #define sbb128(first, second, carry, sum) \ |
---|
| 151 | do\ |
---|
| 152 | { union {__m128i bitblock;\ |
---|
| 153 | uint64_t int64[2];} rslt;\ |
---|
| 154 | \ |
---|
| 155 | union {__m128i bitblock;\ |
---|
| 156 | uint64_t int64[2];} x;\ |
---|
| 157 | \ |
---|
| 158 | union {__m128i bitblock;\ |
---|
| 159 | uint64_t int64[2];} y;\ |
---|
| 160 | \ |
---|
| 161 | x.bitblock = first;\ |
---|
| 162 | y.bitblock = second;\ |
---|
| 163 | \ |
---|
| 164 | double_int64_sbb(x.int64[0], x.int64[1], y.int64[0], y.int64[1], \ |
---|
| 165 | rslt.int64[0], rslt.int64[1], carry);\ |
---|
| 166 | sum = rslt.bitblock;\ |
---|
| 167 | }while(0) |
---|
| 168 | |
---|
[384] | 169 | /* |
---|
[383] | 170 | void bitstream_gen(CopyState cstate) { |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | int carry1=0; |
---|
| 174 | int carry0=0; |
---|
| 175 | int CarryTemp20=0; |
---|
| 176 | int carry2=0; |
---|
| 177 | int carry4=0; |
---|
| 178 | int carry1_i=0; |
---|
| 179 | int carry3=0; |
---|
| 180 | int carry2_i=0; |
---|
| 181 | int carry_brw0=0; |
---|
| 182 | int carry3_i=0; |
---|
| 183 | int carry0_i=0; |
---|
| 184 | BitBlock _strct_csvclass__classify_bytes__temp6; |
---|
| 185 | BitBlock _strct_csvclass__classify_bytes__temp7; |
---|
| 186 | BitBlock _strct_csvclass__classify_bytes__temp4; |
---|
| 187 | BitBlock _strct_csvclass__classify_bytes__temp5; |
---|
| 188 | BitBlock array_bit__6_; |
---|
| 189 | BitBlock _strct_csvclass__classify_bytes__strct_lex__CR_; |
---|
| 190 | BitBlock delim; |
---|
| 191 | BitBlock _strct_csvclass__classify_bytes__temp8; |
---|
| 192 | BitBlock _strct_csvclass__classify_bytes__temp9; |
---|
| 193 | BitBlock Temp13; |
---|
| 194 | BitBlock Temp12; |
---|
| 195 | BitBlock Temp19; |
---|
| 196 | BitBlock quote_end; |
---|
| 197 | BitBlock _strct_csvclass__classify_bytes__strct_lex__Comma_; |
---|
| 198 | BitBlock Temp3; |
---|
| 199 | BitBlock Temp13_temp; |
---|
| 200 | BitBlock Temp4_temp; |
---|
| 201 | BitBlock _strct_csvclass__classify_bytes__temp16; |
---|
| 202 | BitBlock array_bit__4_; |
---|
| 203 | BitBlock _strct_csvclass__classify_bytes__temp10; |
---|
| 204 | BitBlock _strct_csvclass__classify_bytes__temp11; |
---|
| 205 | BitBlock _strct_csvclass__classify_bytes__temp12; |
---|
| 206 | BitBlock _strct_csvclass__classify_bytes__temp18; |
---|
| 207 | BitBlock _strct_csvclass__classify_bytes__temp19; |
---|
| 208 | BitBlock array_bit__2_; |
---|
| 209 | BitBlock array_bit__7_; |
---|
| 210 | BitBlock array_bit__5_; |
---|
| 211 | BitBlock _strct_csvclass__classify_bytes__temp17; |
---|
| 212 | BitBlock _strct_csvclass__classify_bytes__strct_lex__DQuote_; |
---|
| 213 | BitBlock CSV_cursor; |
---|
| 214 | BitBlock AllOne = simd_const_1(1); |
---|
| 215 | BitBlock AllZero = simd_const_1(0); |
---|
| 216 | BitBlock quote_mask; |
---|
| 217 | BitBlock Temp20; |
---|
| 218 | BitBlock Temp21; |
---|
| 219 | BitBlock _strct_csvclass__classify_bytes__strct_lex__LF_; |
---|
| 220 | BitBlock eol; |
---|
| 221 | BitBlock _strct_csvclass__classify_bytes__temp21; |
---|
| 222 | BitBlock _strct_csvclass__classify_bytes__temp20; |
---|
| 223 | BitBlock array_bit__3_; |
---|
| 224 | BitBlock Temp4; |
---|
| 225 | BitBlock array_bit__1_; |
---|
| 226 | BitBlock quote_start; |
---|
| 227 | BitBlock array_bit__0_; |
---|
| 228 | |
---|
| 229 | BytePack * U8; |
---|
| 230 | |
---|
| 231 | int block_pos = 0; |
---|
| 232 | int i=0; |
---|
| 233 | int chars_read = 0; |
---|
| 234 | |
---|
| 235 | |
---|
| 236 | CSV_cursor = sisd_from_int(1); |
---|
| 237 | |
---|
| 238 | U8 = simd_new(8); |
---|
| 239 | |
---|
| 240 | do{ |
---|
| 241 | U8 = (BytePack *)(&(cstate->raw_buf[block_pos])); |
---|
| 242 | chars_read = min(cstate->raw_buf_len-block_pos,BLOCK_SIZE_BITS); |
---|
| 243 | if(chars_read==0)break; |
---|
| 244 | for (i = chars_read;i < BLOCK_SIZE_BITS; i++) { |
---|
| 245 | ((char *) U8)[i] = 0; |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | s2p_bytepack(U8[7], U8[6], U8[5], U8[4], U8[3], U8[2], U8[1], U8[0], |
---|
| 249 | array_bit__0_,array_bit__1_,array_bit__2_,array_bit__3_,array_bit__4_,array_bit__5_,array_bit__6_,array_bit__7_); |
---|
| 250 | |
---|
| 251 | |
---|
| 252 | _strct_csvclass__classify_bytes__temp4 = simd_and(array_bit__4_,array_bit__5_); |
---|
| 253 | _strct_csvclass__classify_bytes__temp5 = simd_or(array_bit__6_,array_bit__7_); |
---|
| 254 | _strct_csvclass__classify_bytes__temp6 = simd_andc(_strct_csvclass__classify_bytes__temp4,_strct_csvclass__classify_bytes__temp5); |
---|
| 255 | _strct_csvclass__classify_bytes__temp7 = simd_or(array_bit__0_,array_bit__1_); |
---|
| 256 | _strct_csvclass__classify_bytes__temp8 = simd_andc(array_bit__2_,array_bit__3_); |
---|
| 257 | _strct_csvclass__classify_bytes__temp9 = simd_andc(_strct_csvclass__classify_bytes__temp8,_strct_csvclass__classify_bytes__temp7); |
---|
| 258 | _strct_csvclass__classify_bytes__temp10 = simd_or(array_bit__4_,array_bit__5_); |
---|
| 259 | _strct_csvclass__classify_bytes__temp11 = simd_andc(array_bit__6_,array_bit__7_); |
---|
| 260 | _strct_csvclass__classify_bytes__temp12 = simd_andc(_strct_csvclass__classify_bytes__temp11,_strct_csvclass__classify_bytes__temp10); |
---|
| 261 | _strct_csvclass__classify_bytes__strct_lex__DQuote_ = simd_and(_strct_csvclass__classify_bytes__temp9,_strct_csvclass__classify_bytes__temp12); |
---|
| 262 | _strct_csvclass__classify_bytes__temp16 = simd_or(array_bit__2_,array_bit__3_); |
---|
| 263 | _strct_csvclass__classify_bytes__temp17 = simd_or(_strct_csvclass__classify_bytes__temp7,_strct_csvclass__classify_bytes__temp16); |
---|
| 264 | _strct_csvclass__classify_bytes__temp18 = simd_andc(array_bit__7_,array_bit__6_); |
---|
| 265 | _strct_csvclass__classify_bytes__temp19 = simd_and(_strct_csvclass__classify_bytes__temp4,_strct_csvclass__classify_bytes__temp18); |
---|
| 266 | _strct_csvclass__classify_bytes__strct_lex__CR_ = simd_andc(_strct_csvclass__classify_bytes__temp19,_strct_csvclass__classify_bytes__temp17); |
---|
| 267 | _strct_csvclass__classify_bytes__temp20 = simd_andc(array_bit__4_,array_bit__5_); |
---|
| 268 | _strct_csvclass__classify_bytes__temp21 = simd_and(_strct_csvclass__classify_bytes__temp20,_strct_csvclass__classify_bytes__temp11); |
---|
| 269 | _strct_csvclass__classify_bytes__strct_lex__LF_ = simd_andc(_strct_csvclass__classify_bytes__temp21,_strct_csvclass__classify_bytes__temp17); |
---|
| 270 | _strct_csvclass__classify_bytes__strct_lex__Comma_ = simd_and(_strct_csvclass__classify_bytes__temp9,_strct_csvclass__classify_bytes__temp6); |
---|
| 271 | |
---|
| 272 | quote_start = AllZero; |
---|
| 273 | quote_end = AllZero; |
---|
| 274 | |
---|
| 275 | while (bitblock_has_bit(CSV_cursor)||((CarryTemp20&LAHF_CARRY)>0)) { |
---|
| 276 | |
---|
| 277 | CarryTemp20 = 0; |
---|
| 278 | Temp3 = simd_andc(AllOne,_strct_csvclass__classify_bytes__strct_lex__DQuote_); |
---|
| 279 | adc128(CSV_cursor, Temp3, carry0, Temp4_temp); |
---|
| 280 | Temp4 = simd_andc(Temp4_temp, Temp3); |
---|
| 281 | CSV_cursor = simd_and(Temp4,_strct_csvclass__classify_bytes__strct_lex__DQuote_); |
---|
| 282 | quote_start = simd_or(quote_start,CSV_cursor); |
---|
| 283 | adc128(CSV_cursor, CSV_cursor, carry1, CSV_cursor); |
---|
| 284 | Temp12 = simd_andc(AllOne,_strct_csvclass__classify_bytes__strct_lex__DQuote_); |
---|
| 285 | adc128(CSV_cursor, Temp12, carry2, Temp13_temp); |
---|
| 286 | Temp13 = simd_andc(Temp13_temp, Temp12); |
---|
| 287 | CSV_cursor = simd_and(Temp13,_strct_csvclass__classify_bytes__strct_lex__DQuote_); |
---|
| 288 | quote_end = simd_or(quote_end,CSV_cursor); |
---|
| 289 | adc128(CSV_cursor, CSV_cursor, carry3, CSV_cursor); |
---|
| 290 | carry0_i = carry0_i|carry0; |
---|
| 291 | carry1_i = carry1_i|carry1; |
---|
| 292 | carry2_i = carry2_i|carry2; |
---|
| 293 | carry3_i = carry3_i|carry3; |
---|
| 294 | carry0 = 0; |
---|
| 295 | carry1 = 0; |
---|
| 296 | carry2 = 0; |
---|
| 297 | carry3 = 0; |
---|
| 298 | } |
---|
| 299 | carry3 = carry3_i; |
---|
| 300 | carry2 = carry2_i; |
---|
| 301 | carry1 = carry1_i; |
---|
| 302 | carry0 = carry0_i; |
---|
| 303 | carry3_i = 0; |
---|
| 304 | carry2_i = 0; |
---|
| 305 | carry1_i = 0; |
---|
| 306 | carry0_i = 0; |
---|
| 307 | CarryTemp20 = carry0|carry1; |
---|
| 308 | CarryTemp20 = CarryTemp20|carry3; |
---|
| 309 | CarryTemp20 = CarryTemp20|carry2; |
---|
| 310 | sbb128(quote_end, quote_start, carry_brw0, quote_mask); |
---|
| 311 | Temp19 = simd_andc(_strct_csvclass__classify_bytes__strct_lex__CR_,quote_mask); |
---|
| 312 | adc128(Temp19, Temp19, carry4, Temp20); |
---|
| 313 | Temp21 = simd_andc(_strct_csvclass__classify_bytes__strct_lex__LF_,quote_mask); |
---|
| 314 | eol = simd_or(Temp20,Temp21); |
---|
| 315 | delim = simd_andc(_strct_csvclass__classify_bytes__strct_lex__Comma_,quote_mask); |
---|
| 316 | |
---|
| 317 | cstate->EOL_stream[block_pos/BLOCK_SIZE_BITS]=eol; |
---|
| 318 | cstate->delim_stream[block_pos/BLOCK_SIZE_BITS]=delim; |
---|
| 319 | |
---|
| 320 | block_pos += chars_read; |
---|
| 321 | }while (chars_read == BLOCK_SIZE_BITS); |
---|
[384] | 322 | }*/ |
---|
| 323 | /*quote as '\'',escape as '\\'*/ |
---|
| 324 | void bitstream_gen3(CopyState cstate) { |
---|
| 325 | |
---|
| 326 | |
---|
| 327 | BitBlock temp1; |
---|
| 328 | BitBlock temp2; |
---|
| 329 | BitBlock temp3; |
---|
| 330 | BitBlock temp4; |
---|
| 331 | BitBlock temp5; |
---|
| 332 | BitBlock temp6; |
---|
| 333 | BitBlock temp7; |
---|
| 334 | BitBlock temp8; |
---|
| 335 | BitBlock temp9; |
---|
| 336 | BitBlock temp10; |
---|
| 337 | BitBlock temp11; |
---|
| 338 | BitBlock temp12; |
---|
| 339 | BitBlock temp13; |
---|
| 340 | BitBlock temp14; |
---|
| 341 | BitBlock temp15; |
---|
| 342 | BitBlock temp16; |
---|
| 343 | BitBlock temp17; |
---|
| 344 | BitBlock temp18; |
---|
| 345 | BitBlock temp19; |
---|
| 346 | BitBlock temp20; |
---|
| 347 | BitBlock temp21; |
---|
| 348 | BitBlock temp22; |
---|
| 349 | BitBlock temp23; |
---|
| 350 | BitBlock temp24; |
---|
| 351 | BitBlock temp25; |
---|
| 352 | |
---|
| 353 | BitBlock CR; |
---|
| 354 | BitBlock LF; |
---|
| 355 | BitBlock Comma; |
---|
| 356 | BitBlock DQuote; |
---|
| 357 | BitBlock SQuote; |
---|
| 358 | BitBlock HT; |
---|
| 359 | BitBlock EOL; |
---|
| 360 | BitBlock Delim; |
---|
| 361 | |
---|
| 362 | BitBlock p2; |
---|
| 363 | BitBlock p4; |
---|
| 364 | BitBlock p8; |
---|
| 365 | BitBlock p16; |
---|
| 366 | BitBlock p32; |
---|
| 367 | BitBlock p64; |
---|
| 368 | BitBlock quote_mask; |
---|
| 369 | BitBlock BackSlash; |
---|
| 370 | BitBlock quote_base; |
---|
| 371 | |
---|
| 372 | BytePack * U8; |
---|
| 373 | BitBlock * bit; |
---|
| 374 | |
---|
| 375 | int block_pos = 0; |
---|
| 376 | int i=0; |
---|
| 377 | int chars_read = 0; |
---|
| 378 | |
---|
| 379 | |
---|
| 380 | quote_base = simd_const_8(0); |
---|
| 381 | |
---|
| 382 | U8 = simd_new(8); |
---|
| 383 | bit = simd_new(8); |
---|
| 384 | do{ |
---|
| 385 | U8 = (BytePack *)(&(cstate->raw_buf[block_pos])); |
---|
| 386 | chars_read = min(cstate->raw_buf_len-block_pos,BLOCK_SIZE_BITS); |
---|
| 387 | if(chars_read==0)break; |
---|
| 388 | for (i = chars_read;i < BLOCK_SIZE_BITS; i++) { |
---|
| 389 | ((char *) U8)[i] = 0; |
---|
| 390 | } |
---|
| 391 | |
---|
| 392 | s2p_bytepack(U8[7], U8[6], U8[5], U8[4], U8[3], U8[2], U8[1], U8[0], |
---|
| 393 | bit[0],bit[1],bit[2],bit[3],bit[4],bit[5],bit[6],bit[7]); |
---|
| 394 | |
---|
| 395 | |
---|
| 396 | temp1 = simd_andc(bit[1], bit[0]); |
---|
| 397 | temp2 = simd_andc(bit[3], bit[2]); |
---|
| 398 | temp3 = simd_and(temp1, temp2); |
---|
| 399 | temp4 = simd_and(bit[4], bit[5]); |
---|
| 400 | temp5 = simd_or(bit[6], bit[7]); |
---|
| 401 | temp6 = simd_andc(temp4, temp5); |
---|
| 402 | BackSlash = simd_and(temp3, temp6); |
---|
| 403 | temp7 = simd_or(bit[0], bit[1]); |
---|
| 404 | temp8 = simd_andc(bit[2], bit[3]); |
---|
| 405 | temp9 = simd_andc(temp8, temp7); |
---|
| 406 | temp10 = simd_or(bit[4], bit[5]); |
---|
| 407 | temp11 = simd_andc(bit[6], bit[7]); |
---|
| 408 | temp12 = simd_andc(temp11, temp10); |
---|
| 409 | DQuote = simd_and(temp9, temp12); |
---|
| 410 | temp13 = simd_andc(bit[5], bit[4]); |
---|
| 411 | temp14 = simd_and(bit[6], bit[7]); |
---|
| 412 | temp15 = simd_and(temp13, temp14); |
---|
| 413 | SQuote = simd_and(temp9, temp15); |
---|
| 414 | temp16 = simd_or(bit[2], bit[3]); |
---|
| 415 | temp17 = simd_or(temp7, temp16); |
---|
| 416 | temp18 = simd_andc(bit[7], bit[6]); |
---|
| 417 | temp19 = simd_and(temp4, temp18); |
---|
| 418 | CR = simd_andc(temp19, temp17); |
---|
| 419 | temp20 = simd_andc(bit[4], bit[5]); |
---|
| 420 | temp21 = simd_and(temp20, temp11); |
---|
| 421 | LF = simd_andc(temp21, temp17); |
---|
| 422 | Comma = simd_and(temp9, temp6); |
---|
| 423 | temp22 = simd_and(temp20, temp18); |
---|
| 424 | HT = simd_andc(temp22, temp17); |
---|
| 425 | |
---|
| 426 | int carry0=0; |
---|
| 427 | int carry1=0; |
---|
| 428 | int carry2=0; |
---|
| 429 | BitBlock even; |
---|
| 430 | BitBlock odd; |
---|
| 431 | BitBlock start; |
---|
| 432 | BitBlock even_start; |
---|
| 433 | BitBlock even_final; |
---|
| 434 | BitBlock odd_start; |
---|
| 435 | BitBlock odd_final; |
---|
| 436 | BitBlock escape; |
---|
| 437 | |
---|
| 438 | odd = simd_const_2(1); |
---|
| 439 | even = simd_const_2(2); |
---|
| 440 | |
---|
| 441 | adc128(BackSlash,BackSlash,carry0,temp23); |
---|
| 442 | start = simd_andc(BackSlash,temp23); |
---|
| 443 | even_start = simd_and(start,even); |
---|
| 444 | adc128(even_start, BackSlash, carry1, temp24); |
---|
| 445 | even_final = simd_andc(temp24,BackSlash); |
---|
| 446 | escape = simd_and(even_final,odd); |
---|
| 447 | |
---|
| 448 | odd_start = simd_and(start,odd); |
---|
| 449 | adc128(odd_start, BackSlash, carry2, temp25); |
---|
| 450 | odd_final = simd_andc(temp25,BackSlash); |
---|
| 451 | escape = simd_or(escape, simd_and(odd_final,even)); |
---|
| 452 | |
---|
| 453 | SQuote = simd_andc(SQuote,escape); |
---|
| 454 | |
---|
| 455 | p2 = simd_xor(SQuote,simd_slli_128(SQuote,1)); |
---|
| 456 | p4 = simd_xor(p2,simd_slli_128(p2,2)); |
---|
| 457 | p8 = simd_xor(p4,simd_slli_128(p4,4)); |
---|
| 458 | p16 = simd_xor(p8,simd_slli_128(p8,8)); |
---|
| 459 | p32 = simd_xor(p16,simd_slli_128(p16,16)); |
---|
| 460 | p64 = simd_xor(p32,simd_slli_128(p32,32)); |
---|
| 461 | quote_mask = simd_xor(p64,simd_slli_128(p64,64)); |
---|
| 462 | quote_mask = simd_xor(quote_base,quote_mask); |
---|
| 463 | quote_base = simd_shufflei_32(simd_srai_32(quote_mask,31),0xFF); |
---|
| 464 | |
---|
| 465 | |
---|
| 466 | Delim = simd_andc(Comma,quote_mask); |
---|
| 467 | EOL = simd_andc(simd_or(simd_slli_128(CR,1),LF),quote_mask); |
---|
| 468 | |
---|
| 469 | cstate->EOL_stream[block_pos/BLOCK_SIZE_BITS]=EOL; |
---|
| 470 | cstate->delim_stream[block_pos/BLOCK_SIZE_BITS]=Delim; |
---|
| 471 | |
---|
| 472 | block_pos += chars_read; |
---|
| 473 | }while (chars_read == BLOCK_SIZE_BITS); |
---|
| 474 | } |
---|
| 475 | /*quote and escape as '\"'*/ |
---|
| 476 | void bitstream_gen(CopyState cstate) { |
---|
| 477 | |
---|
| 478 | |
---|
| 479 | BitBlock temp1; |
---|
| 480 | BitBlock temp2; |
---|
| 481 | BitBlock temp3; |
---|
| 482 | BitBlock temp4; |
---|
| 483 | BitBlock temp5; |
---|
| 484 | BitBlock temp6; |
---|
| 485 | BitBlock temp7; |
---|
| 486 | BitBlock temp8; |
---|
| 487 | BitBlock temp9; |
---|
| 488 | BitBlock temp10; |
---|
| 489 | BitBlock temp11; |
---|
| 490 | BitBlock temp12; |
---|
| 491 | BitBlock temp13; |
---|
| 492 | BitBlock temp14; |
---|
| 493 | BitBlock temp15; |
---|
| 494 | BitBlock temp16; |
---|
| 495 | BitBlock temp17; |
---|
| 496 | BitBlock temp18; |
---|
| 497 | BitBlock temp19; |
---|
| 498 | BitBlock temp20; |
---|
| 499 | BitBlock temp21; |
---|
| 500 | BitBlock temp22; |
---|
| 501 | |
---|
| 502 | BitBlock CR; |
---|
| 503 | BitBlock LF; |
---|
| 504 | BitBlock Comma; |
---|
| 505 | BitBlock DQuote; |
---|
| 506 | BitBlock SQuote; |
---|
| 507 | BitBlock HT; |
---|
| 508 | BitBlock EOL; |
---|
| 509 | BitBlock Delim; |
---|
| 510 | |
---|
| 511 | BitBlock p2; |
---|
| 512 | BitBlock p4; |
---|
| 513 | BitBlock p8; |
---|
| 514 | BitBlock p16; |
---|
| 515 | BitBlock p32; |
---|
| 516 | BitBlock p64; |
---|
| 517 | BitBlock quote_mask; |
---|
| 518 | BitBlock BackSlash; |
---|
| 519 | BitBlock quote_base; |
---|
| 520 | |
---|
| 521 | BytePack * U8; |
---|
| 522 | BitBlock * bit; |
---|
| 523 | |
---|
| 524 | int block_pos = 0; |
---|
| 525 | int i=0; |
---|
| 526 | int chars_read = 0; |
---|
| 527 | |
---|
| 528 | |
---|
| 529 | quote_base = simd_const_8(0); |
---|
| 530 | |
---|
| 531 | U8 = simd_new(8); |
---|
| 532 | bit = simd_new(8); |
---|
| 533 | do{ |
---|
| 534 | U8 = (BytePack *)(&(cstate->raw_buf[block_pos])); |
---|
| 535 | chars_read = min(cstate->raw_buf_len-block_pos,BLOCK_SIZE_BITS); |
---|
| 536 | if(chars_read==0)break; |
---|
| 537 | for (i = chars_read;i < BLOCK_SIZE_BITS; i++) { |
---|
| 538 | ((char *) U8)[i] = 0; |
---|
| 539 | } |
---|
| 540 | |
---|
| 541 | s2p_bytepack(U8[7], U8[6], U8[5], U8[4], U8[3], U8[2], U8[1], U8[0], |
---|
| 542 | bit[0],bit[1],bit[2],bit[3],bit[4],bit[5],bit[6],bit[7]); |
---|
| 543 | |
---|
| 544 | |
---|
| 545 | temp1 = simd_andc(bit[1], bit[0]); |
---|
| 546 | temp2 = simd_andc(bit[3], bit[2]); |
---|
| 547 | temp3 = simd_and(temp1, temp2); |
---|
| 548 | temp4 = simd_and(bit[4], bit[5]); |
---|
| 549 | temp5 = simd_or(bit[6], bit[7]); |
---|
| 550 | temp6 = simd_andc(temp4, temp5); |
---|
| 551 | BackSlash = simd_and(temp3, temp6); |
---|
| 552 | temp7 = simd_or(bit[0], bit[1]); |
---|
| 553 | temp8 = simd_andc(bit[2], bit[3]); |
---|
| 554 | temp9 = simd_andc(temp8, temp7); |
---|
| 555 | temp10 = simd_or(bit[4], bit[5]); |
---|
| 556 | temp11 = simd_andc(bit[6], bit[7]); |
---|
| 557 | temp12 = simd_andc(temp11, temp10); |
---|
| 558 | DQuote = simd_and(temp9, temp12); |
---|
| 559 | temp13 = simd_andc(bit[5], bit[4]); |
---|
| 560 | temp14 = simd_and(bit[6], bit[7]); |
---|
| 561 | temp15 = simd_and(temp13, temp14); |
---|
| 562 | SQuote = simd_and(temp9, temp15); |
---|
| 563 | temp16 = simd_or(bit[2], bit[3]); |
---|
| 564 | temp17 = simd_or(temp7, temp16); |
---|
| 565 | temp18 = simd_andc(bit[7], bit[6]); |
---|
| 566 | temp19 = simd_and(temp4, temp18); |
---|
| 567 | CR = simd_andc(temp19, temp17); |
---|
| 568 | temp20 = simd_andc(bit[4], bit[5]); |
---|
| 569 | temp21 = simd_and(temp20, temp11); |
---|
| 570 | LF = simd_andc(temp21, temp17); |
---|
| 571 | Comma = simd_and(temp9, temp6); |
---|
| 572 | temp22 = simd_and(temp20, temp18); |
---|
| 573 | HT = simd_andc(temp22, temp17); |
---|
| 574 | |
---|
| 575 | p2 = simd_xor(DQuote,simd_slli_128(DQuote,1)); |
---|
| 576 | p4 = simd_xor(p2,simd_slli_128(p2,2)); |
---|
| 577 | p8 = simd_xor(p4,simd_slli_128(p4,4)); |
---|
| 578 | p16 = simd_xor(p8,simd_slli_128(p8,8)); |
---|
| 579 | p32 = simd_xor(p16,simd_slli_128(p16,16)); |
---|
| 580 | p64 = simd_xor(p32,simd_slli_128(p32,32)); |
---|
| 581 | quote_mask = simd_xor(p64,simd_slli_128(p64,64)); |
---|
| 582 | quote_mask = simd_xor(quote_base,quote_mask); |
---|
| 583 | quote_base = simd_shufflei_32(simd_srai_32(quote_mask,31),0xFF); |
---|
| 584 | |
---|
| 585 | |
---|
| 586 | Delim = simd_andc(Comma,quote_mask); |
---|
| 587 | EOL = simd_andc(simd_or(simd_slli_128(CR,1),LF),quote_mask); |
---|
| 588 | |
---|
| 589 | cstate->EOL_stream[block_pos/BLOCK_SIZE_BITS]=EOL; |
---|
| 590 | cstate->delim_stream[block_pos/BLOCK_SIZE_BITS]=Delim; |
---|
| 591 | |
---|
| 592 | block_pos += chars_read; |
---|
| 593 | }while (chars_read == BLOCK_SIZE_BITS); |
---|
| 594 | } |
---|
| 595 | |
---|
| 596 | void direct_bitstream_gen(CopyState cstate) { |
---|
| 597 | |
---|
| 598 | |
---|
| 599 | BitBlock Quote; |
---|
| 600 | BitBlock EOL; |
---|
| 601 | BitBlock CR; |
---|
| 602 | BitBlock LF; |
---|
| 603 | |
---|
| 604 | BitBlock p2; |
---|
| 605 | BitBlock p4; |
---|
| 606 | BitBlock p8; |
---|
| 607 | BitBlock p16; |
---|
| 608 | BitBlock p32; |
---|
| 609 | BitBlock p64; |
---|
| 610 | BitBlock quote_mask; |
---|
| 611 | BitBlock quote_base; |
---|
| 612 | BitBlock quote_splat; |
---|
| 613 | BitBlock CR_splat; |
---|
| 614 | BitBlock LF_splat; |
---|
| 615 | BytePack * bytepack; |
---|
| 616 | |
---|
| 617 | |
---|
| 618 | int block_pos = 0; |
---|
| 619 | int i=0; |
---|
| 620 | int chars_read = 0; |
---|
| 621 | |
---|
| 622 | |
---|
| 623 | quote_base = simd_const_8(0); |
---|
| 624 | |
---|
| 625 | quote_splat = simd_const_8(cstate->quote[0]); |
---|
| 626 | CR_splat = simd_const_8('\r'); |
---|
| 627 | LF_splat = simd_const_8('\n'); |
---|
| 628 | |
---|
| 629 | bytepack = simd_new(8); |
---|
| 630 | |
---|
| 631 | do{ |
---|
| 632 | bytepack = (BytePack *)(&(cstate->raw_buf[block_pos])); |
---|
| 633 | |
---|
| 634 | chars_read = min(cstate->raw_buf_len-block_pos,BLOCK_SIZE_BITS); |
---|
| 635 | if(chars_read==0)break; |
---|
| 636 | for (i = chars_read;i < BLOCK_SIZE_BITS; i++) { |
---|
| 637 | ((char *) bytepack)[i] = 0; |
---|
| 638 | } |
---|
| 639 | |
---|
| 640 | for(i=0;i<8;i++){ |
---|
| 641 | ((short*)&Quote)[i] = (short)_mm_movemask_epi8(simd_eq_8(bytepack[i], quote_splat)); |
---|
| 642 | ((short*)&CR)[i] = (short)_mm_movemask_epi8(simd_eq_8(bytepack[i], CR_splat)); |
---|
| 643 | ((short*)&LF)[i] = (short)_mm_movemask_epi8(simd_eq_8(bytepack[i], LF_splat)); |
---|
| 644 | } |
---|
| 645 | |
---|
| 646 | p2 = simd_xor(Quote,simd_slli_128(Quote,1)); |
---|
| 647 | p4 = simd_xor(p2,simd_slli_128(p2,2)); |
---|
| 648 | p8 = simd_xor(p4,simd_slli_128(p4,4)); |
---|
| 649 | p16 = simd_xor(p8,simd_slli_128(p8,8)); |
---|
| 650 | p32 = simd_xor(p16,simd_slli_128(p16,16)); |
---|
| 651 | p64 = simd_xor(p32,simd_slli_128(p32,32)); |
---|
| 652 | quote_mask = simd_xor(p64,simd_slli_128(p64,64)); |
---|
| 653 | quote_mask = simd_xor(quote_base,quote_mask); |
---|
| 654 | quote_base = simd_shufflei_32(simd_srai_32(quote_mask,31),0xFF); |
---|
| 655 | |
---|
| 656 | EOL = simd_andc(simd_or(simd_slli_128(CR,1),LF),quote_mask); |
---|
| 657 | |
---|
| 658 | cstate->EOL_stream[block_pos/BLOCK_SIZE_BITS]=EOL; |
---|
| 659 | |
---|
| 660 | |
---|
| 661 | block_pos += chars_read; |
---|
| 662 | }while (chars_read == BLOCK_SIZE_BITS); |
---|
| 663 | } |
---|
| 664 | |
---|
| 665 | void direct_bitstream_gen_with_escape(CopyState cstate) { |
---|
| 666 | |
---|
| 667 | |
---|
| 668 | BitBlock Quote; |
---|
| 669 | BitBlock EOL; |
---|
| 670 | BitBlock CR; |
---|
| 671 | BitBlock LF; |
---|
| 672 | BitBlock Escape; |
---|
| 673 | |
---|
| 674 | BitBlock p2; |
---|
| 675 | BitBlock p4; |
---|
| 676 | BitBlock p8; |
---|
| 677 | BitBlock p16; |
---|
| 678 | BitBlock p32; |
---|
| 679 | BitBlock p64; |
---|
| 680 | BitBlock quote_mask; |
---|
| 681 | BitBlock quote_base; |
---|
| 682 | BitBlock quote_splat; |
---|
| 683 | BitBlock escape_splat; |
---|
| 684 | BitBlock CR_splat; |
---|
| 685 | BitBlock LF_splat; |
---|
| 686 | BytePack * bytepack; |
---|
| 687 | |
---|
| 688 | int carry0=0; |
---|
| 689 | int carry1=0; |
---|
| 690 | int carry2=0; |
---|
| 691 | BitBlock even; |
---|
| 692 | BitBlock odd; |
---|
| 693 | BitBlock start; |
---|
| 694 | BitBlock even_start; |
---|
| 695 | BitBlock even_final; |
---|
| 696 | BitBlock odd_start; |
---|
| 697 | BitBlock odd_final; |
---|
| 698 | BitBlock escape; |
---|
| 699 | BitBlock temp0; |
---|
| 700 | BitBlock temp1; |
---|
| 701 | BitBlock temp2; |
---|
| 702 | BitBlock escape_outof_quote; |
---|
| 703 | BitBlock cursor; |
---|
| 704 | BitBlock temp_Quote; |
---|
| 705 | |
---|
| 706 | int block_pos = 0; |
---|
| 707 | int i=0; |
---|
| 708 | int chars_read = 0; |
---|
| 709 | |
---|
| 710 | quote_base = simd_const_8(0); |
---|
| 711 | |
---|
| 712 | quote_splat = simd_const_8(cstate->quote[0]); |
---|
| 713 | escape_splat = simd_const_8(cstate->escape[0]); |
---|
| 714 | CR_splat = simd_const_8('\r'); |
---|
| 715 | LF_splat = simd_const_8('\n'); |
---|
| 716 | |
---|
| 717 | bytepack = simd_new(8); |
---|
| 718 | |
---|
| 719 | do{ |
---|
| 720 | bytepack = (BytePack *)(&(cstate->raw_buf[block_pos])); |
---|
| 721 | |
---|
| 722 | chars_read = min(cstate->raw_buf_len-block_pos,BLOCK_SIZE_BITS); |
---|
| 723 | if(chars_read==0)break; |
---|
| 724 | for (i = chars_read;i < BLOCK_SIZE_BITS; i++) { |
---|
| 725 | ((char *) bytepack)[i] = 0; |
---|
| 726 | } |
---|
| 727 | |
---|
| 728 | for(i=0;i<8;i++){ |
---|
| 729 | ((short*)&Quote)[i] = (short)_mm_movemask_epi8(simd_eq_8(bytepack[i], quote_splat)); |
---|
| 730 | ((short*)&CR)[i] = (short)_mm_movemask_epi8(simd_eq_8(bytepack[i], CR_splat)); |
---|
| 731 | ((short*)&LF)[i] = (short)_mm_movemask_epi8(simd_eq_8(bytepack[i], LF_splat)); |
---|
| 732 | ((short*)&Escape)[i] = (short)_mm_movemask_epi8(simd_eq_8(bytepack[i], escape_splat)); |
---|
| 733 | } |
---|
| 734 | |
---|
| 735 | if(bitblock_has_bit(Escape)){ |
---|
| 736 | odd = simd_const_2(1); |
---|
| 737 | even = simd_const_2(2); |
---|
| 738 | |
---|
| 739 | adc128(Escape,Escape,carry0,temp0); |
---|
| 740 | start = simd_andc(Escape,temp0); |
---|
| 741 | even_start = simd_and(start,even); |
---|
| 742 | adc128(even_start, Escape, carry1, temp1); |
---|
| 743 | even_final = simd_andc(temp1,Escape); |
---|
| 744 | escape = simd_and(even_final,odd); |
---|
| 745 | |
---|
| 746 | odd_start = simd_and(start,odd); |
---|
| 747 | adc128(odd_start, Escape, carry2, temp2); |
---|
| 748 | odd_final = simd_andc(temp2,Escape); |
---|
| 749 | escape = simd_or(escape, simd_and(odd_final,even)); |
---|
| 750 | |
---|
| 751 | temp_Quote = simd_andc(Quote,escape); |
---|
| 752 | p2 = simd_xor(temp_Quote,simd_slli_128(temp_Quote,1)); |
---|
| 753 | p4 = simd_xor(p2,simd_slli_128(p2,2)); |
---|
| 754 | p8 = simd_xor(p4,simd_slli_128(p4,4)); |
---|
| 755 | p16 = simd_xor(p8,simd_slli_128(p8,8)); |
---|
| 756 | p32 = simd_xor(p16,simd_slli_128(p16,16)); |
---|
| 757 | p64 = simd_xor(p32,simd_slli_128(p32,32)); |
---|
| 758 | quote_mask = simd_xor(p64,simd_slli_128(p64,64)); |
---|
| 759 | quote_mask = simd_xor(quote_base,quote_mask); |
---|
| 760 | |
---|
| 761 | escape_outof_quote = simd_andc(escape,quote_mask); |
---|
| 762 | while (bitblock_has_bit(escape_outof_quote)){ |
---|
| 763 | cursor = sisd_from_int(1); |
---|
| 764 | cursor = simd_and(simd_add_64(cursor, simd_not(escape_outof_quote)),escape_outof_quote); |
---|
| 765 | escape = simd_andc(escape, cursor); |
---|
| 766 | temp_Quote = simd_andc(Quote,escape); |
---|
| 767 | p2 = simd_xor(temp_Quote,simd_slli_128(temp_Quote,1)); |
---|
| 768 | p4 = simd_xor(p2,simd_slli_128(p2,2)); |
---|
| 769 | p8 = simd_xor(p4,simd_slli_128(p4,4)); |
---|
| 770 | p16 = simd_xor(p8,simd_slli_128(p8,8)); |
---|
| 771 | p32 = simd_xor(p16,simd_slli_128(p16,16)); |
---|
| 772 | p64 = simd_xor(p32,simd_slli_128(p32,32)); |
---|
| 773 | quote_mask = simd_xor(p64,simd_slli_128(p64,64)); |
---|
| 774 | quote_mask = simd_xor(quote_base,quote_mask); |
---|
| 775 | escape_outof_quote = simd_andc(escape,quote_mask); |
---|
| 776 | break; |
---|
| 777 | } |
---|
| 778 | |
---|
| 779 | quote_base = simd_shufflei_32(simd_srai_32(quote_mask,31),0xFF); |
---|
| 780 | Quote = temp_Quote; |
---|
| 781 | } |
---|
| 782 | else{ |
---|
| 783 | p2 = simd_xor(Quote,simd_slli_128(Quote,1)); |
---|
| 784 | p4 = simd_xor(p2,simd_slli_128(p2,2)); |
---|
| 785 | p8 = simd_xor(p4,simd_slli_128(p4,4)); |
---|
| 786 | p16 = simd_xor(p8,simd_slli_128(p8,8)); |
---|
| 787 | p32 = simd_xor(p16,simd_slli_128(p16,16)); |
---|
| 788 | p64 = simd_xor(p32,simd_slli_128(p32,32)); |
---|
| 789 | quote_mask = simd_xor(p64,simd_slli_128(p64,64)); |
---|
| 790 | quote_mask = simd_xor(quote_base,quote_mask); |
---|
| 791 | quote_base = simd_shufflei_32(simd_srai_32(quote_mask,31),0xFF); |
---|
| 792 | } |
---|
| 793 | |
---|
| 794 | EOL = simd_andc(simd_or(simd_slli_128(CR,1),LF),quote_mask); |
---|
| 795 | cstate->EOL_stream[block_pos/BLOCK_SIZE_BITS]=EOL; |
---|
| 796 | |
---|
| 797 | |
---|
| 798 | block_pos += chars_read; |
---|
| 799 | }while (chars_read == BLOCK_SIZE_BITS); |
---|
[383] | 800 | } |
---|