[blake3] Add assembly implementations (#25921)

* [blake3] Extend build script to support assembly implementations

* [blake3] Add AVX512 assembly implementation
This commit is contained in:
Yuriy O'Donnell 2022-07-25 23:54:59 +02:00 committed by GitHub
parent 4b03e5c3d5
commit 09d4f8ec9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 7 deletions

View File

@ -10,22 +10,46 @@ target_sources(blake3 PRIVATE
c/blake3_portable.c c/blake3_portable.c
) )
# This is a bit too exotic to be worth supporting right now if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
target_compile_definitions(blake3 PRIVATE BLAKE3_NO_AVX512=1) target_compile_definitions(blake3 PRIVATE BLAKE3_NO_AVX512=1)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
target_sources(blake3 PRIVATE target_sources(blake3 PRIVATE
c/blake3_avx2.c c/blake3_avx2.c
c/blake3_sse2.c c/blake3_sse2.c
c/blake3_sse41.c c/blake3_sse41.c
) )
if (NOT MSVC) if(NOT MSVC)
set_source_files_properties(c/blake3_avx2.c COMPILE_FLAGS -mavx2) set_source_files_properties(c/blake3_avx2.c COMPILE_FLAGS -mavx2)
set_source_files_properties(c/blake3_sse2.c COMPILE_FLAGS -msse2) set_source_files_properties(c/blake3_sse2.c COMPILE_FLAGS -msse2)
set_source_files_properties(c/blake3_sse41.c COMPILE_FLAGS -msse4.1) set_source_files_properties(c/blake3_sse41.c COMPILE_FLAGS -msse4.1)
endif() endif()
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
if(WIN32 AND MSVC)
enable_language(ASM_MASM)
target_sources(blake3 PRIVATE
c/blake3_avx2_x86-64_windows_msvc.asm
c/blake3_sse2_x86-64_windows_msvc.asm
c/blake3_sse41_x86-64_windows_msvc.asm
c/blake3_avx512_x86-64_windows_msvc.asm
)
elseif(WIN32 AND NOT MSVC)
enable_language(ASM)
target_sources(blake3 PRIVATE
c/blake3_avx2_x86-64_windows_gnu.S
c/blake3_sse2_x86-64_windows_gnu.S
c/blake3_sse41_x86-64_windows_gnu.S
c/blake3_avx512_x86-64_windows_gnu.S
)
else()
enable_language(ASM)
target_sources(blake3 PRIVATE
c/blake3_avx2_x86-64_unix.S
c/blake3_sse2_x86-64_unix.S
c/blake3_sse41_x86-64_unix.S
c/blake3_avx512_x86-64_unix.S
)
endif()
else() else()
target_compile_definitions(blake3 PRIVATE BLAKE3_NO_SSE2=1 BLAKE3_NO_SSE41=1 BLAKE3_NO_AVX2=1) target_compile_definitions(blake3 PRIVATE BLAKE3_NO_SSE2=1 BLAKE3_NO_SSE41=1 BLAKE3_NO_AVX2=1 BLAKE3_NO_AVX512=1)
endif() endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")

View File

@ -1,6 +1,7 @@
{ {
"name": "blake3", "name": "blake3",
"version": "1.3.1", "version": "1.3.1",
"port-version": 1,
"description": "BLAKE3 cryptographic hash function.", "description": "BLAKE3 cryptographic hash function.",
"homepage": "https://github.com/BLAKE3-team/BLAKE3", "homepage": "https://github.com/BLAKE3-team/BLAKE3",
"license": "CC0-1.0 OR Apache-2.0", "license": "CC0-1.0 OR Apache-2.0",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "78cffdc59cdb9f1c75dffa671578203d0a79fa42",
"version": "1.3.1",
"port-version": 1
},
{ {
"git-tree": "62a5201ca424389c823b9b4be3d588e1cbb88a58", "git-tree": "62a5201ca424389c823b9b4be3d588e1cbb88a58",
"version": "1.3.1", "version": "1.3.1",

View File

@ -502,7 +502,7 @@
}, },
"blake3": { "blake3": {
"baseline": "1.3.1", "baseline": "1.3.1",
"port-version": 0 "port-version": 1
}, },
"blas": { "blas": {
"baseline": "1", "baseline": "1",