[PATCH] D122884: [Support] [BLAKE3] Fix compilation with CMAKE_OSX_ARCHITECTURES

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 2 14:04:28 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG578d85e924fc: [Support] [BLAKE3] Fix compilation with CMAKE_OSX_ARCHITECTURES (authored by mstorsjo).

Changed prior to commit:
  https://reviews.llvm.org/D122884?vs=419677&id=420012#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122884/new/

https://reviews.llvm.org/D122884

Files:
  llvm/lib/Support/BLAKE3/CMakeLists.txt


Index: llvm/lib/Support/BLAKE3/CMakeLists.txt
===================================================================
--- llvm/lib/Support/BLAKE3/CMakeLists.txt
+++ llvm/lib/Support/BLAKE3/CMakeLists.txt
@@ -74,16 +74,30 @@
       blake3_avx512_x86-64_unix.S
     )
   endif()
+else()
+  # In a macOS Universal build (setting CMAKE_OSX_ARCHITECTURES to multiple
+  # values), IS_X64 and IS_ARM64 won't be set, but compilation of the source
+  # files will consider targeting either of them (each source file is
+  # internally compiled once for each architecture). Thus, if we on the CMake
+  # level decide not to include the assembly files, tell the source to not
+  # expect it to be present either.
+  #
+  # Also, if targeting i386, then the blake3 source code automatically enables
+  # the SIMD implementations, but we don't provide those sources.
+  #
+  # FIXME: We could improve the CMAKE_OSX_ARCHITECTURES configuration by
+  # including all SIMD implementation files that might be relevant, and
+  # wrapping them in ifdefs like "#ifdef __x86_64__", to allow them to be
+  # included in a build for any architecture.
+  add_definitions(-DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_SSE2)
 endif()
 
 if (IS_ARM64)
   list(APPEND LLVM_BLAKE3_FILES
     blake3_neon.c
   )
-endif()
-
-if (IS_X64 AND NOT CAN_USE_ASSEMBLER)
-  add_definitions(-DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_SSE2)
+else()
+  add_definitions(-DBLAKE3_USE_NEON=0)
 endif()
 
 add_library(LLVMSupportBlake3 OBJECT EXCLUDE_FROM_ALL ${LLVM_BLAKE3_FILES})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122884.420012.patch
Type: text/x-patch
Size: 1576 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220402/da083f8c/attachment.bin>


More information about the llvm-commits mailing list