Răsfoiți Sursa

Make ARM64EC build available with NEON intrinsics (#1897)

Co-authored-by: Jorrit Rouwe <[email protected]>
vinod-sv 6 ore în urmă
părinte
comite
757c6b7719
3 a modificat fișierele cu 18 adăugiri și 14 ștergeri
  1. 1 0
      Build/CMakeLists.txt
  2. 3 0
      Build/cmake_vs2022_cl_arm_ec.bat
  3. 14 14
      Jolt/Core/Core.h

+ 1 - 0
Build/CMakeLists.txt

@@ -297,6 +297,7 @@ function(SET_INTERPROCEDURAL_OPTIMIZATION)
 	# On ARM, whole program optimization triggers an internal compiler error during code gen, so we don't turn it on
 	# When compiling as a shared lib with MinGW, turning on LTO causes errors of the form 'ld.exe: cannot export symbol X wrong type (4 vs 3)'
 	if (INTERPROCEDURAL_OPTIMIZATION
+		AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM64EC")
 		AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM64")
 		AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM")
 		AND (NOT CROSS_COMPILE_ARM OR ("${CROSS_COMPILE_ARM_TARGET}" STREQUAL "aarch64-linux-gnu"))

+ 3 - 0
Build/cmake_vs2022_cl_arm_ec.bat

@@ -0,0 +1,3 @@
+@echo off
+cmake -S . -B VS2022_CL_ARM_EC -G "Visual Studio 17 2022" -A ARM64EC %*
+echo Open VS2022_CL_ARM_EC\JoltPhysics.sln to build the project.

+ 14 - 14
Jolt/Core/Core.h

@@ -117,7 +117,20 @@
 #endif
 
 // Detect CPU architecture
-#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
+#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM) || defined(_M_ARM64EC)
+	// ARM CPU architecture
+	#define JPH_CPU_ARM
+	#if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
+		#define JPH_CPU_ARCH_BITS 64
+		#define JPH_USE_NEON
+		#define JPH_VECTOR_ALIGNMENT 16
+		#define JPH_DVECTOR_ALIGNMENT 32
+	#else
+		#define JPH_CPU_ARCH_BITS 32
+		#define JPH_VECTOR_ALIGNMENT 8 // 32-bit ARM does not support aligning on the stack on 16 byte boundaries
+		#define JPH_DVECTOR_ALIGNMENT 8
+	#endif
+#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
 	// X86 CPU architecture
 	#define JPH_CPU_X86
 	#if defined(__x86_64__) || defined(_M_X64)
@@ -167,19 +180,6 @@
 			#error Undefined compiler
 		#endif
 	#endif
-#elif defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
-	// ARM CPU architecture
-	#define JPH_CPU_ARM
-	#if defined(__aarch64__) || defined(_M_ARM64)
-		#define JPH_CPU_ARCH_BITS 64
-		#define JPH_USE_NEON
-		#define JPH_VECTOR_ALIGNMENT 16
-		#define JPH_DVECTOR_ALIGNMENT 32
-	#else
-		#define JPH_CPU_ARCH_BITS 32
-		#define JPH_VECTOR_ALIGNMENT 8 // 32-bit ARM does not support aligning on the stack on 16 byte boundaries
-		#define JPH_DVECTOR_ALIGNMENT 8
-	#endif
 #elif defined(__riscv)
 	// RISC-V CPU architecture
 	#define JPH_CPU_RISCV