Skip to content

[Support/BLAKE3] Re-enable BLAKE3 assembly implementation #4151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions llvm/lib/Support/BLAKE3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ set(LLVM_BLAKE3_FILES
blake3_portable.c
)

# Temporary disable assembly until rdar://91050484 is investigated.
set(CAN_USE_ASSEMBLER FALSE)

# The BLAKE3 team recommends using the assembly versions, from the README:
#
# "For each of the x86 SIMD instruction sets, four versions are available:
Expand All @@ -21,9 +18,17 @@ if (MSVC)
else()
check_symbol_exists(__x86_64__ "" IS_X64)
check_symbol_exists(__aarch64__ "" IS_ARM64)

if (IS_X64)
# Clang-6 needs this flag.
set_source_files_properties(blake3_avx512_x86-64_windows_gnu.S
PROPERTIES COMPILE_OPTIONS "-mavx512vl")
set_source_files_properties(blake3_avx512_x86-64_unix.S
PROPERTIES COMPILE_OPTIONS "-mavx512vl")
endif()
endif()

if (IS_X64 AND CAN_USE_ASSEMBLER)
if (IS_X64)
if (MSVC)
enable_language(ASM_MASM)
list(APPEND LLVM_BLAKE3_FILES
Expand Down Expand Up @@ -55,9 +60,5 @@ if (IS_ARM64)
)
endif()

if (IS_X64 AND NOT CAN_USE_ASSEMBLER)
add_definitions(-DBLAKE3_NO_AVX512 -DBLAKE3_NO_AVX2 -DBLAKE3_NO_SSE41 -DBLAKE3_NO_SSE2)
endif()

add_library(LLVMSupportBlake3 OBJECT EXCLUDE_FROM_ALL ${LLVM_BLAKE3_FILES})
llvm_update_compile_flags(LLVMSupportBlake3)