Created
June 5, 2018 05:10
-
-
Save geofflangdale/ff0dfbcf8c8db07e8ae6d59975a0b190 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
void match_multiple_smh_latency_test(T & smh, std::vector<u8 *> & buffers, std::vector<size_t> & lengths, | |
std::vector<u32> & results) { | |
u32 i = 0; | |
u32 tmp = 0; | |
#ifndef NO_UNROLL | |
// NOTE: experimental code only. Note that the addition of 'tmp' - being the id of a possible | |
// match - could take us RIGHT outside our buffer if we actually matched something. We aren't | |
// in this particular run, but so it goes. Saner would be to build up an all-zero id vector | |
for (; i+7 < buffers.size(); i+=8) { | |
tmp = results[i+0] = smh.match(buffers[i+0 + tmp], lengths[i+0] + tmp); LFENCE | |
tmp = results[i+1] = smh.match(buffers[i+1 + tmp], lengths[i+1] + tmp); LFENCE | |
tmp = results[i+2] = smh.match(buffers[i+2 + tmp], lengths[i+2] + tmp); LFENCE | |
tmp = results[i+3] = smh.match(buffers[i+3 + tmp], lengths[i+3] + tmp); LFENCE | |
tmp = results[i+4] = smh.match(buffers[i+4 + tmp], lengths[i+4] + tmp); LFENCE | |
tmp = results[i+5] = smh.match(buffers[i+5 + tmp], lengths[i+5] + tmp); LFENCE | |
tmp = results[i+6] = smh.match(buffers[i+6 + tmp], lengths[i+6] + tmp); LFENCE | |
tmp = results[i+7] = smh.match(buffers[i+7 + tmp], lengths[i+7] + tmp); LFENCE | |
} | |
#endif | |
for (; i < buffers.size(); ++i) { | |
tmp = results[i] = smh.match(buffers[i + tmp], lengths[i + tmp]); LFENCE | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment