mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-15 17:02:14 +03:00
build/run on machines that only have SSE2 with SIMDE (#303)
This allows the use of SIMDE library to emulate SSSE3/SSE4.2 instructions on SSE2-only (x86-64-v2) hardware. --------- Co-authored-by: G.E <gregory.economou@vectorcamp.gr> Co-authored-by: Konstantinos Margaritis <konstantinos@vectorcamp.gr>
This commit is contained in:
@@ -42,6 +42,7 @@ HS_PUBLIC_API
|
||||
hs_error_t HS_CDECL hs_valid_platform(void) {
|
||||
/* Hyperscan requires SSSE3, anything else is a bonus */
|
||||
#if !defined(VS_SIMDE_BACKEND) && (defined(ARCH_IA32) || defined(ARCH_X86_64))
|
||||
// cppcheck-suppress knownConditionTrueFalse
|
||||
if (check_ssse3()) {
|
||||
return HS_SUCCESS;
|
||||
} else {
|
||||
|
||||
@@ -210,9 +210,13 @@ int check_avx512vbmi(void) {
|
||||
|
||||
static inline
|
||||
int check_ssse3(void) {
|
||||
#if defined(VS_SIMDE_NATIVE) && (defined(ARCH_IA32) || defined(ARCH_X86_64))
|
||||
return 1;
|
||||
#else
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
cpuid(1, 0, &eax, &ebx, &ecx, &edx);
|
||||
return !!(ecx & CPUID_SSSE3);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline
|
||||
|
||||
@@ -36,7 +36,9 @@
|
||||
#include "ue2common.h"
|
||||
|
||||
#if defined(VS_SIMDE_BACKEND)
|
||||
#ifndef VECTORSIZE
|
||||
#define VECTORSIZE 16
|
||||
#endif
|
||||
#define SIMDE_ENABLE_NATIVE_ALIASES
|
||||
#if !defined(VS_SIMDE_NATIVE)
|
||||
#define SIMDE_NO_NATIVE
|
||||
|
||||
Reference in New Issue
Block a user