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:
g. economou
2024-07-10 21:20:17 +03:00
committed by GitHub
parent 328b74656b
commit f1e0977f07
5 changed files with 75 additions and 14 deletions

View File

@@ -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 {

View File

@@ -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

View File

@@ -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