mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-10-09 07:42:21 +03:00
Move SVE functions into their own files.
Change-Id: I995ba4b7d2b558ee403693ee45d747d414d3b177
This commit is contained in:
committed by
Konstantinos Margaritis
parent
87a6733fbe
commit
0f39535621
@@ -43,70 +43,11 @@
|
||||
#include "util/intrinsics.h"
|
||||
|
||||
#ifdef HAVE_SVE
|
||||
|
||||
really_really_inline
|
||||
uint64_t accelSearchGetOffset(svbool_t matched) {
|
||||
return svcntp_b8(svptrue_b8(), svbrkb_z(svptrue_b8(), matched));
|
||||
}
|
||||
|
||||
really_really_inline
|
||||
const u8 *accelSearchCheckMatched(const u8 *buf, svbool_t matched) {
|
||||
if (unlikely(svptest_any(svptrue_b8(), matched))) {
|
||||
const u8 *matchPos = buf + accelSearchGetOffset(matched);
|
||||
DEBUG_PRINTF("match pos %p\n", matchPos);
|
||||
return matchPos;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
really_really_inline
|
||||
const u8 *accelRevSearchCheckMatched(const u8 *buf, svbool_t matched) {
|
||||
if (unlikely(svptest_any(svptrue_b8(), matched))) {
|
||||
const u8 *matchPos = buf + (svcntb() -
|
||||
svcntp_b8(svptrue_b8(), svbrka_z(svptrue_b8(), svrev_b8(matched))));
|
||||
DEBUG_PRINTF("match pos %p\n", matchPos);
|
||||
return matchPos;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static really_inline
|
||||
svuint8_t getSVEMaskFrom128(m128 mask) {
|
||||
return svld1_u8(svptrue_pat_b8(SV_VL16), (const uint8_t *)&mask);
|
||||
}
|
||||
|
||||
#include "simd_utils_sve.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SVE2
|
||||
|
||||
static really_inline
|
||||
svuint8_t getCharMaskSingle(const u8 c, bool noCase) {
|
||||
if (noCase) {
|
||||
uint16_t chars_u16 = (c & 0xdf) | ((c | 0x20) << 8);
|
||||
return svreinterpret_u8(svdup_u16(chars_u16));
|
||||
} else {
|
||||
return svdup_u8(c);
|
||||
}
|
||||
}
|
||||
|
||||
static really_inline
|
||||
svuint16_t getCharMaskDouble(const u8 c0, const u8 c1, bool noCase) {
|
||||
if (noCase) {
|
||||
const uint64_t lowerFirst = c0 & 0xdf;
|
||||
const uint64_t upperFirst = c0 | 0x20;
|
||||
const uint64_t lowerSecond = c1 & 0xdf;
|
||||
const uint64_t upperSecond = c1 | 0x20;
|
||||
const uint64_t chars = lowerFirst | (lowerSecond << 8)
|
||||
| (lowerFirst << 16) | (upperSecond) << 24
|
||||
| (upperFirst << 32) | (lowerSecond) << 40
|
||||
| (upperFirst << 48) | (upperSecond) << 56;
|
||||
return svreinterpret_u16(svdup_u64(chars));
|
||||
} else {
|
||||
uint16_t chars_u16 = c0 | (c1 << 8);
|
||||
return svdup_u16(chars_u16);
|
||||
}
|
||||
}
|
||||
|
||||
#include "simd_utils_sve2.h"
|
||||
#endif
|
||||
|
||||
#include <string.h> // for memcpy
|
||||
|
Reference in New Issue
Block a user