SIMD implementation of scan16 for x86
Some checks failed
Tests / Clang total: 1038, passed: 1038
Clang |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / SIMD fallback total: 1038, passed: 1038
Tests / Release [gcc] total: 1038, passed: 1038
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 775, passed: 775
Tests / Coverage total: 779, passed: 779
weaselab/conflict-set/pipeline/head There was a failure building this commit

Closes #29
This commit is contained in:
2024-06-27 22:21:41 -07:00
parent 2df7000090
commit efb0e52a0a

View File

@@ -1713,9 +1713,10 @@ downLeftSpine:
bool scan16(const int64_t *vs, const uint8_t *is, int begin, int end,
int64_t readVersion) {
assert(end - begin < 256);
#ifdef HAS_ARM_NEON
assert(end - begin < 256);
uint8x16_t indices;
memcpy(&indices, is, 16);
// 0xff for each in bounds
@@ -1727,7 +1728,21 @@ bool scan16(const int64_t *vs, const uint8_t *is, int begin, int end,
uint64_t compared = 0;
for (int i = 0; i < 16; ++i) {
compared |= (uint64_t(vs[i] > readVersion) << (i << 2));
compared |= uint64_t(vs[i] > readVersion) << (i << 2);
}
return !(compared & mask);
#elif defined(HAS_AVX)
__m128i indices;
memcpy(&indices, is, 16);
indices = _mm_sub_epi8(indices, _mm_set1_epi8(begin));
uint32_t mask = ~_mm_movemask_epi8(_mm_cmpeq_epi8(
indices, _mm_max_epu8(indices, _mm_set1_epi8(end - begin))));
uint32_t compared = 0;
for (int i = 0; i < 16; ++i) {
compared |= (vs[i] > readVersion) << i;
}
return !(compared & mask);
@@ -1739,7 +1754,7 @@ bool scan16(const int64_t *vs, const uint8_t *is, int begin, int end,
uint32_t compared = 0;
for (int i = 0; i < 16; ++i) {
compared |= ((vs[i] > readVersion) << i);
compared |= (vs[i] > readVersion) << i;
}
uint32_t mask = 0;
for (int i = 0; i < 16; ++i) {