]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
enable SIMDe backend
authorKonstantnos Margaritis <konstantinos@vectorcamp.gr>
Tue, 21 Nov 2023 17:13:33 +0000 (17:13 +0000)
committerKonstantnos Margaritis <konstantinos@vectorcamp.gr>
Tue, 21 Nov 2023 17:13:33 +0000 (17:13 +0000)
src/nfa/shufti_simd.hpp
src/nfa/truffle_simd.hpp
src/nfa/vermicelli_simd.cpp
src/util/arch/common/simd_utils.h
src/util/bitutils.h
src/util/intrinsics.h
src/util/match.hpp
src/util/simd_types.h
src/util/simd_utils.h

index 0f8e2a7b25def526fff582199d2c8d1a089edefc..30df80bf546d57fcc269aafa639290c7c46799ec 100644 (file)
@@ -52,7 +52,7 @@ template <uint16_t S>
 static really_inline
 SuperVector<S> blockDoubleMask(SuperVector<S> mask1_lo, SuperVector<S> mask1_hi, SuperVector<S> mask2_lo, SuperVector<S> mask2_hi, SuperVector<S> chars);
 
-#if defined(ARCH_IA32) || defined(ARCH_X86_64)
+#if defined(ARCH_IA32) || defined(ARCH_X86_64) || defined(SIMDE_BACKEND)
 #include "x86/shufti.hpp"
 #elif defined(ARCH_ARM32) || defined(ARCH_AARCH64)
 #include "arm/shufti.hpp"
index e07e92f6bfb0a6e64afc2fdd432bbd33f7af7492..0214833cf9e742e2c9269ac4f4bcdf46c6f1661f 100644 (file)
@@ -45,7 +45,7 @@ template <uint16_t S>
 static really_inline
 const SuperVector<S> blockSingleMask(SuperVector<S> shuf_mask_lo_highclear, SuperVector<S> shuf_mask_lo_highset, SuperVector<S> chars);
 
-#if defined(ARCH_IA32) || defined(ARCH_X86_64)
+#if defined(ARCH_IA32) || defined(ARCH_X86_64) || defined(SIMDE_BACKEND)
 #include "x86/truffle.hpp"
 #elif defined(ARCH_ARM32) || defined(ARCH_AARCH64)
 #include "arm/truffle.hpp"
index a0da07194887b865a335fe5cb74e85cd3f1f7d79..c5fbc39a0ee2edf11b5407ff3637cfe59c9b9185 100644 (file)
@@ -71,7 +71,7 @@ const u8 *vermicelliDoubleMaskedBlock(SuperVector<S> const data, SuperVector<S>
                                       SuperVector<S> const mask1, SuperVector<S> const mask2,
                                       u8 const c1, u8 const c2, u8 const m1, u8 const m2, u8 const *buf, u16 const len);
 
-#if defined(ARCH_IA32) || defined(ARCH_X86_64)
+#if defined(ARCH_IA32) || defined(ARCH_X86_64) || defined(SIMDE_BACKEND)
 #include "x86/vermicelli.hpp"
 #elif defined(ARCH_ARM32) || defined(ARCH_AARCH64)
 #include "arm/vermicelli.hpp"
index d142ee9a67d45e7dc7ed8f7a7acb3a6cb3c14ea7..2542f0f670349e7dd68f3b9e2bd5db6f49e80c8d 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <string.h> // for memcpy
 
-#if !defined(HAVE_SIMD_128_BITS)
+#if !defined(HAVE_SIMD_128_BITS) && !defined(SIMDE_BACKEND)
 #error "You need at least a 128-bit capable SIMD engine!"
 #endif // HAVE_SIMD_128_BITS
 
@@ -88,7 +88,7 @@ static inline void print_m128_2x64(const char *label, m128 vec) {
 #define print_m128_2x64(label, vec) ;
 #endif
 
-#if !defined(ARCH_IA32) && !defined(ARCH_X86_64)
+#if !defined(ARCH_IA32) && !defined(ARCH_X86_64) && !defined(SIMDE_BACKEND)
 #define ZEROES_8 0, 0, 0, 0, 0, 0, 0, 0
 #define ZEROES_31 ZEROES_8, ZEROES_8, ZEROES_8, 0, 0, 0, 0, 0, 0, 0
 #define ZEROES_32 ZEROES_8, ZEROES_8, ZEROES_8, ZEROES_8
index ffc8f45df779fbf3ced79c9d2ea89fce518ba965..7e006158b9cb0567af194facc9ba018bebff468c 100644 (file)
 #include "util/arch/arm/bitutils.h"
 #elif defined(ARCH_PPC64EL)
 #include "util/arch/ppc64el/bitutils.h"
+#else
+#include "util/arch/common/bitutils.h"
+#define clz32_impl clz32_impl_c
+#define clz64_impl clz64_impl_c
+#define ctz32_impl ctz32_impl_c
+#define ctz64_impl ctz64_impl_c
+#define lg2_impl lg2_impl_c
+#define lg2_64_impl lg2_64_impl_c
+#define findAndClearLSB_32_impl findAndClearLSB_32_impl_c
+#define findAndClearLSB_64_impl findAndClearLSB_64_impl_c
+#define findAndClearMSB_32_impl findAndClearMSB_32_impl_c
+#define findAndClearMSB_64_impl findAndClearMSB_64_impl_c
+#define compress32_impl compress32_impl_c
+#define compress64_impl compress64_impl_c
+#define compress128_impl compress128_impl_c
+#define expand32_impl expand32_impl_c
+#define expand64_impl expand64_impl_c
+#define expand128_impl expand128_impl_c
+#define bf64_iterate_impl bf64_iterate_impl_c
+#define bf64_set_impl bf64_set_impl_c
+#define bf64_unset_impl bf64_unset_impl_c
+#define rank_in_mask32_impl rank_in_mask32_impl_c
+#define rank_in_mask64_impl rank_in_mask64_impl_c
+#define pext32_impl pext32_impl_c
+#define pext64_impl pext64_impl_c
 #endif
 
 static really_inline
index 08eb6ba6aa960ec84268cb7bf84540ab4756bf7d..64f9e9bad641110a4bf1ed414536330dc55455e4 100644 (file)
@@ -74,8 +74,6 @@
 #  endif
 #elif defined(USE_PPC64EL_ALTIVEC_H)
 #include <altivec.h>
-#else
-#error no intrinsics file
 #endif
 
 #endif // INTRINSICS_H
index 003c665f9c4c1c84f31a63609acdbbc9dc7d1dab..68497349dc4e0b3f86a261d06a97f04f77c9206e 100644 (file)
@@ -49,7 +49,7 @@ const u8 *first_zero_match_inverted(const u8 *buf, SuperVector<S> v, u16 const l
 template <u16 S>
 const u8 *last_zero_match_inverted(const u8 *buf, SuperVector<S> v, u16 len = S);
 
-#if defined(ARCH_IA32) || defined(ARCH_X86_64)
+#if defined(ARCH_IA32) || defined(ARCH_X86_64) || defined(SIMDE_BACKEND)
 #include "util/arch/x86/match.hpp"
 #elif defined(ARCH_ARM32) || defined(ARCH_AARCH64)
 #include "util/arch/arm/match.hpp"
index 4f0fd1a98739c9b795eb3b70054d4a0c132def0d..b9e2a492cee3ffdf44d22c888b046534df8ccf31 100644 (file)
 #include "util/arch/ppc64el/simd_types.h"
 #endif
 
-#if !defined(m128) && !defined(HAVE_SIMD_128_BITS)
-typedef struct ALIGN_DIRECTIVE {u64a hi; u64a lo;} m128;
+#if defined(SIMDE_BACKEND)
+#define VECTORSIZE 16
+#define SIMDE_ENABLE_NATIVE_ALIASES
+#define SIMDE_NO_NATIVE
+#include "simde/simde/x86/sse4.2.h"
+typedef simde__m128i m128;
+#define HAVE_SIMD_128_BITS
 #endif
 
 #if !defined(m256) && !defined(HAVE_SIMD_256_BITS)
index 2f0012c62c00e9d98e4329c1dde1d573b8671136..0ed66177823445e21b2f18d559fb9215fe2a3354 100644 (file)
@@ -67,6 +67,8 @@ extern const char vbs_mask_data[];
 #include "util/arch/arm/simd_utils.h"
 #elif defined(ARCH_PPC64EL)
 #include "util/arch/ppc64el/simd_utils.h"
+#elif defined(SIMDE_BACKEND)
+#include "util/arch/simde/simd_utils.h"
 #endif
 
 #include "util/arch/common/simd_utils.h"