2

我尝试使用 SSE 来加速任务:

在高级方面:

string a = "^&a&*";
string b = "abcdef";
bool c = a_contain_any_alphabet_in_b(a, b);

使用 SSE(伪代码)的更多详细信息:

a = _mm_set_epi8('^', .....);
b = _mm_set_epi8('a', .....);
mask = _mm_cmpestrm (a, la, b, lb, imm8); // _SIDD_CMP_EQUAL_ANY toggle

... and then extract mask

我的问题是如果我b包含超过 128 位怎么办?诸如我要检查字符串的情况a包含记录在b. 但是一组字母是8*52大于 的位128

我想出的天真的方法是b分成许多__mm128i.

mask1 = _mm_cmpestrm (a, la, b1, lb, imm8);
mask2 = _mm_cmpestrm (a, la, b2, lb, imm8);
...
and do some operation with all masks

我想知道有什么方法可以做得更聪明吗?

4

0 回答 0