From af443edca17649a6f2e66707746f482caefe3d1a Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sun, 1 Mar 2026 17:54:07 +0000 Subject: Enable arch on windows --- README.md | 6 +++--- build.bat | 20 +++++++++++++++----- src/utils/prefetch.h | 16 ++++------------ 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 338a280..64871b5 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,9 @@ can be used to build the basic shell, while Builds and runs the unit tests. See `build.bat help` for a list of all available options. -Note: At the moment certain optimizations, such as multithreading and -advanced CPU instructions, are not supported on Windows. -Work is ongoing to improve Windows support. +Note: The build script for Windows does not support all the options +available with build.sh. If you want to tune the build options, you'll +have to manually edit the build script. ## Running tests diff --git a/build.bat b/build.bat index 91cc4db..b082e03 100644 --- a/build.bat +++ b/build.bat @@ -9,15 +9,25 @@ if [%1]==[/d] ( SET CC=clang SET CXX=clang++ -SET ARCH=PORTABLE SET THREADS=16 SET SANITIZE= -:: TODO depends on ARCH variable -SET ARCHOPTS= -:: TODO depends on SANITIZE variable -SET DFLAGS=-g3 -DDEBUG +SET ARCH=PORTABLE +clang -march=native -dM -E - < NUL | findstr /C:"__AVX2__" >NUL 2>&1 +if %ERRORLEVEL% EQU 0 ( + SET ARCH=AVX2 + SET ARCHOPTS=-mavx2 + goto :ArchDone +) +clang -march=native -dM -E - < NUL | findstr /C:"__ARM_NEON" >NUL 2>&1 +if %ERRORLEVEL% EQU 0 ( + SET ARCH=NEON + goto :ArchDone +) +:ArchDone + +SET DFLAGS=-g3 -DDEBUG SET WARNINGS=-Wno-deprecated-declarations SET VARIABLES=-DTHREADS=%THREADS% -D%ARCH% SET OFLAGS=-O3 diff --git a/src/utils/prefetch.h b/src/utils/prefetch.h index 89b14e8..a2c41ef 100644 --- a/src/utils/prefetch.h +++ b/src/utils/prefetch.h @@ -1,15 +1,7 @@ -#if defined(AVX2) - -#define prefetch(a, i) _mm_prefetch(a+i, _MM_HINT_T0) - -#else #if defined(__GNUC__) || defined(__clang__) - -#define prefetch(a, i) __builtin_prefetch(a+i, 0, 0) - + #define prefetch(a, i) __builtin_prefetch(a+i, 0, 0) +#elif defined(AVX2) + #define prefetch(a, i) _mm_prefetch((char *)(a+i), _MM_HINT_T0) #else - -#define prefetch(a, i) (void)i - -#endif + #define prefetch(a, i) (void)i #endif -- cgit v1.3