| 371 | } |
| 372 | |
| 373 | inline void HashLen0to16Batch(const char** data, uint64_t* h_out, size_t len) { |
| 374 | __m512i k0_batch = _mm512_set1_epi64(k0); |
| 375 | __m512i k1_batch = _mm512_set1_epi64(k1); |
| 376 | __m512i k2_batch = _mm512_set1_epi64(k2); |
| 377 | __m512i factor_2_batch = _mm512_set1_epi64(2); |
| 378 | __m512i factor_len_batch = _mm512_set1_epi64(len); |
| 379 | |
| 380 | if (len >= 8) { |
| 381 | __m512i mul = _mm512_mullo_epi64_hand(factor_len_batch, factor_2_batch); |
| 382 | mul = _mm512_add_epi64(mul, k2_batch); |
| 383 | __m512i a = Fetch64Batch(data, 0); |
| 384 | a = _mm512_add_epi64(a, k2_batch); |
| 385 | __m512i b = Fetch64Batch(data, len-8); |
| 386 | __m512i c = Rotate64Batch(b, 37); |
| 387 | c = _mm512_mullo_epi64_hand(c, mul); |
| 388 | c = _mm512_add_epi64(c, a); |
| 389 | __m512i d = Rotate64Batch(a, 25); |
| 390 | d = _mm512_add_epi64(d, b); |
| 391 | d = _mm512_mullo_epi64_hand(d, mul); |
| 392 | __m512i ret = HashLen16Batch(c, d, mul); |
| 393 | _mm512_storeu_si512((void*)h_out, ret); |
| 394 | return; |
| 395 | } |
| 396 | if (len >= 4) { |
| 397 | __m512i mul = _mm512_mullo_epi64_hand(factor_len_batch, factor_2_batch); |
| 398 | mul = _mm512_add_epi64(mul, k2_batch); |
| 399 | __m512i a = Fetch32Batch(data, 0); |
| 400 | a = _mm512_slli_epi64(a, 3); |
| 401 | a = _mm512_add_epi64(a, factor_len_batch); |
| 402 | __m512i ret = HashLen16Batch(a, Fetch32Batch(data, len-4), mul); |
| 403 | _mm512_storeu_si512((void*)h_out, ret); |
| 404 | return; |
| 405 | } |
| 406 | if (len > 0) { |
| 407 | __m512i a = Fetch8Batch(data, 0); |
| 408 | __m512i b = Fetch8Batch(data, len >> 1); |
| 409 | __m512i c = Fetch8Batch(data, len-1); |
| 410 | __m512i y = _mm512_slli_epi64(b, 8); |
| 411 | y = _mm512_add_epi64(y, a); |
| 412 | __m512i z = _mm512_slli_epi64(c, 2); |
| 413 | z = _mm512_add_epi64(z, factor_len_batch); |
| 414 | y = _mm512_mullo_epi64_hand(y, k2_batch); |
| 415 | z = _mm512_mullo_epi64_hand(z, k0_batch); |
| 416 | y = _mm512_xor_si512(y, z); |
| 417 | __m512i ret = _mm512_mullo_epi64_hand(ShiftMixBatch(y), k2_batch); |
| 418 | _mm512_storeu_si512((void*)h_out, ret); |
| 419 | return; |
| 420 | } |
| 421 | _mm512_storeu_si512((void*)h_out, k2_batch); |
| 422 | } |
| 423 | |
| 424 | inline void HashLen17to32Batch(const char** data, uint64_t* h_out, size_t len) { |
| 425 | __m512i k2_batch = _mm512_set1_epi64(k2); |
no test coverage detected