mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
add AVX2 specializations
This commit is contained in:
parent
dede600637
commit
b42b187712
@ -56,6 +56,19 @@ const u8 *firstMatch<16>(const u8 *buf, typename SuperVector<16>::movemask_type
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
really_really_inline
|
||||||
|
const u8 *firstMatch<32>(const u8 *buf, typename SuperVector<32>::movemask_type z) {
|
||||||
|
DEBUG_PRINTF("z 0x%08x\n", z);
|
||||||
|
if (unlikely(z != 0xffffffff)) {
|
||||||
|
u32 pos = ctz32(~z);
|
||||||
|
assert(pos < 32);
|
||||||
|
DEBUG_PRINTF("match @ pos %u\n", pos);
|
||||||
|
return buf + pos;
|
||||||
|
} else {
|
||||||
|
return NULL; // no match
|
||||||
|
}
|
||||||
|
}
|
||||||
template <>
|
template <>
|
||||||
really_really_inline
|
really_really_inline
|
||||||
const u8 *firstMatch<64>(const u8 *buf, typename SuperVector<64>::movemask_type z) {
|
const u8 *firstMatch<64>(const u8 *buf, typename SuperVector<64>::movemask_type z) {
|
||||||
@ -86,6 +99,19 @@ const u8 *lastMatch<16>(const u8 *buf, typename SuperVector<16>::movemask_type z
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
really_really_inline
|
||||||
|
const u8 *lastMatch<32>(const u8 *buf, typename SuperVector<32>::movemask_type z) {
|
||||||
|
if (unlikely(z != 0xffffffff)) {
|
||||||
|
u32 pos = clz32(~z);
|
||||||
|
DEBUG_PRINTF("buf=%p, pos=%u\n", buf, pos);
|
||||||
|
assert(pos < 32);
|
||||||
|
return buf + (31 - pos);
|
||||||
|
} else {
|
||||||
|
return NULL; // no match
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
really_really_inline
|
really_really_inline
|
||||||
const u8 *lastMatch<64>(const u8 *buf, typename SuperVector<64>::movemask_type z) {
|
const u8 *lastMatch<64>(const u8 *buf, typename SuperVector<64>::movemask_type z) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user