From 570b76f60029cb04f6bb7ab5da08fb003ea23c13 Mon Sep 17 00:00:00 2001 From: Anthony Roberts Date: Thu, 2 May 2024 20:05:51 +0200 Subject: [PATCH] Enable sse2neon in BLI_simd except for hydra/USD This should get all of the tests to pass on Windows ARM64 platforms. Sadly it needs disabling for hydra/USD stuff as currently it doesn't play nicely with the new preprocessor. @LazyDodo suggested a USD version update may fix this, which is something I can investigate in due course - right now, let's get daily builds up and working :) Pull Request: https://projects.blender.org/blender/blender/pulls/121361 --- source/blender/blenlib/BLI_simd.hh | 8 ++++---- source/blender/io/usd/CMakeLists.txt | 3 ++- source/blender/render/hydra/CMakeLists.txt | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/blender/blenlib/BLI_simd.hh b/source/blender/blenlib/BLI_simd.hh index 7ee862e1003..f6e76eb9346 100644 --- a/source/blender/blenlib/BLI_simd.hh +++ b/source/blender/blenlib/BLI_simd.hh @@ -16,9 +16,8 @@ # error Including BLI_simd.hh requires C++ #endif -// TODO: Re-enable this once blenlib is converted to C++ -#if (defined(__ARM_NEON) /* || (defined(_M_ARM64) && defined(_MSC_VER))*/) && \ - defined(WITH_SSE2NEON) +#if (defined(__ARM_NEON) || (defined(_M_ARM64) && defined(_MSC_VER))) && \ + defined(WITH_SSE2NEON) && !defined(DISABLE_SSE2NEON) /* SSE/SSE2 emulation on ARM Neon. Match SSE precision. */ # if !defined(SSE2NEON_PRECISE_MINMAX) # define SSE2NEON_PRECISE_MINMAX 1 @@ -39,7 +38,8 @@ # define BLI_HAVE_SSE2 0 #endif -#if defined(__ARM_NEON) && defined(WITH_SSE2NEON) +#if (defined(__ARM_NEON) || (defined(_M_ARM64) && defined(_MSC_VER))) && \ + defined(WITH_SSE2NEON) && !defined(DISABLE_SSE2NEON) /* SSE4 is emulated via sse2neon. */ # define BLI_HAVE_SSE4 1 #elif defined(__SSE4_2__) diff --git a/source/blender/io/usd/CMakeLists.txt b/source/blender/io/usd/CMakeLists.txt index 05bd2b073d0..f555e7c572f 100644 --- a/source/blender/io/usd/CMakeLists.txt +++ b/source/blender/io/usd/CMakeLists.txt @@ -54,8 +54,9 @@ if(WIN32) remove_cc_flag("/w34100") if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") # USD currently does not support the new preprocessor, - # and does not use sse2neon, so we can remove it here + # so we remove it here and disable sse2neon remove_cc_flag("/Zc:preprocessor") + add_definitions(-DDISABLE_SSE2NEON) endif() endif() diff --git a/source/blender/render/hydra/CMakeLists.txt b/source/blender/render/hydra/CMakeLists.txt index dca5b0c03cb..ec93be00e97 100644 --- a/source/blender/render/hydra/CMakeLists.txt +++ b/source/blender/render/hydra/CMakeLists.txt @@ -35,8 +35,9 @@ if(WIN32) remove_cc_flag("/w34100") if(CMAKE_SYSTEM_PROCESSOR STREQUAL "ARM64") # USD currently does not support the new preprocessor, - # and does not use sse2neon, so we can remove it here + # so we remove it here and disable sse2neon remove_cc_flag("/Zc:preprocessor") + add_definitions(-DDISABLE_SSE2NEON) endif() endif()