From 4fdb9954ec41fe994d8bebeaf1275fa450486eca Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Fri, 31 Oct 2025 23:44:48 +0900 Subject: [PATCH] [Build] Revert to AVX only for Windows MSVC will arbitrarily include BMI2 instructions when AVX2 is enabled and there is no way to disable this apparently, so go back to AVX for Windows to allow Sandy/Ivy Bridge CPU support --- premake5.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/premake5.lua b/premake5.lua index c7d5d0b32..e62277a2c 100644 --- a/premake5.lua +++ b/premake5.lua @@ -49,7 +49,12 @@ fatalwarnings("All") -- TODO(DrChat): Find a way to disable this on other architectures. if ARCH ~= "ppc64" then - filter("architecture:x86_64") + filter({"architecture:x86_64", "platforms:Windows"}) + -- Use AVX instead of AVX2 on Windows to prevent MSVC from emitting BMI2 instructions + -- MSVC with /arch:AVX2 generates BMI2 unconditionally, breaking Sandy/Ivy Bridge CPUs + vectorextensions("AVX") + filter({"architecture:x86_64", "platforms:not Windows"}) + -- On non-Windows (Linux/Clang), AVX2 is safe as it can be combined with -mno-bmi2 vectorextensions("AVX2") filter({}) end