From e4a552d9bb302d18db8c2202d227349b716b29d7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 13 Nov 2023 12:26:25 +0900 Subject: [PATCH] build: fix GN configuration for deps/base64 --- deps/base64/base64/lib/env.h | 4 ++-- deps/base64/unofficial.gni | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/deps/base64/base64/lib/env.h b/deps/base64/base64/lib/env.h index d5c2fdb7952735..024b46d1f716d7 100644 --- a/deps/base64/base64/lib/env.h +++ b/deps/base64/base64/lib/env.h @@ -46,12 +46,12 @@ #if defined (__x86_64__) // This also works for the x32 ABI, which has a 64-bit word size. # define BASE64_WORDSIZE 64 -#elif defined (_INTEGRAL_MAX_BITS) -# define BASE64_WORDSIZE _INTEGRAL_MAX_BITS #elif defined (__WORDSIZE) # define BASE64_WORDSIZE __WORDSIZE #elif defined (__SIZE_WIDTH__) # define BASE64_WORDSIZE __SIZE_WIDTH__ +#elif defined (_INTEGRAL_MAX_BITS) && !defined(_WIN32) +# define BASE64_WORDSIZE _INTEGRAL_MAX_BITS #else # error BASE64_WORDSIZE_NOT_DEFINED #endif diff --git a/deps/base64/unofficial.gni b/deps/base64/unofficial.gni index 8138d88798e1df..269c62d976d6ad 100644 --- a/deps/base64/unofficial.gni +++ b/deps/base64/unofficial.gni @@ -32,6 +32,7 @@ template("base64_gn_build") { "HAVE_SSE42=1", "HAVE_AVX=1", "HAVE_AVX2=1", + "HAVE_AVX512=1", ] } if (target_cpu == "arm") { @@ -65,6 +66,7 @@ template("base64_gn_build") { ":base64_sse42", ":base64_avx", ":base64_avx2", + ":base64_avx512", ":base64_neon32", ":base64_neon64", ] @@ -111,6 +113,7 @@ template("base64_gn_build") { } } } + source_set("base64_avx2") { configs += [ ":base64_internal_config" ] sources = [ "base64/lib/arch/avx2/codec.c" ] @@ -123,6 +126,21 @@ template("base64_gn_build") { } } + source_set("base64_avx512") { + configs += [ ":base64_internal_config" ] + sources = [ "base64/lib/arch/avx512/codec.c" ] + if (target_cpu == "x86" || target_cpu == "x64") { + if (is_clang || !is_win) { + cflags_c = [ + "-mavx512vl", + "-mavx512vbmi", + ] + } else if (is_win) { + cflags_c = [ "/arch:AVX512" ] + } + } + } + source_set("base64_neon32") { configs += [ ":base64_internal_config" ] sources = [ "base64/lib/arch/neon32/codec.c" ]