Hi,

uh, oh, I referred GitHub's HEAD version, so 0.4.0 has no
-DLIBUNICODE_USE_INTRINSICS=OFF option.

Patches might not be applied if next libunicode released,
but for 0.4.0 is ok uaa@

thanks!

On Sat, 13 Jul 2024 21:35:06 +0900,
Stuart Henderson wrote:
> 
> On 2024/07/13 18:37, SASANO Takayoshi wrote:
> > Hi,
> > 
> > > Looks like this is, at best, ONLY_FOR_ARCHS=amd64 aarch64
> > 
> > How about to disable intrinsics at configure like this?
> > Even if poorer performance, I prefer to use the library with wider
> > architecture.
> 
> > +                   -DLIBUNICODE_USE_INTRINSICS=OFF \
> 
> There's no such cmake flag in 0.4.0.
> 
> This diff builds on i386, I tidied a few unnecessary Makefile variables
> while there. ok?
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/textproc/libunicode/Makefile,v
> diff -u -p -r1.1 Makefile
> --- Makefile  9 Jul 2024 13:56:10 -0000       1.1
> +++ Makefile  13 Jul 2024 12:12:25 -0000
> @@ -1,11 +1,9 @@
>  COMMENT =    Unicode support to C++ with simple and easy APIs
> 
> -V = 0.4.0
> -DISTNAME =   libunicode-${V}
> -
>  GH_ACCOUNT = contour-terminal
>  GH_PROJECT = libunicode
> -GH_TAGNAME = v${V}
> +GH_TAGNAME = v0.4.0
> +REVISION =   0
> 
>  SHARED_LIBS  =       unicode         0.0 # 0.0
>  SHARED_LIBS +=       unicode_loader  0.0 # 0.0
> @@ -36,5 +34,9 @@ CONFIGURE_STYLE =   cmake
> 
>  CONFIGURE_ARGS =     -DLIBUNICODE_TESTING=OFF \
>                       -DLIBUNICODE_UCD_DIR=${LOCALBASE}/share/unicode/ucd
> +
> +.if ${MACHINE_ARCH} != "amd64" && ${MACHINE_ARCH} != "aarch64"
> +CONFIGURE_ARGS +=    -DLIBUNICODE_USE_INTRINSICS=OFF
> +.endif
> 
>  .include <bsd.port.mk>
> Index: patches/patch-CMakeLists_txt
> ===================================================================
> RCS file: patches/patch-CMakeLists_txt
> diff -N patches/patch-CMakeLists_txt
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-CMakeLists_txt      13 Jul 2024 12:12:25 -0000
> @@ -0,0 +1,16 @@
> +From ad31f78a116c844e5c00712b3dcd258c76586e57 Mon Sep 17 00:00:00 2001
> +From: Christian Parpart <christian@parpart.family>
> +Date: Tue, 26 Dec 2023 10:07:16 +0100
> +Subject: [PATCH] Make usage of SSE extension optional
> +
> +Index: CMakeLists.txt
> +--- CMakeLists.txt.orig
> ++++ CMakeLists.txt
> +@@ -43,6 +43,7 @@ option(LIBUNICODE_EXAMPLES "libunicode: Enables buildi
> + option(LIBUNICODE_TESTING "libunicode: Enables building of unittests for 
> libunicode [default: ${MASTER_PROJECT}" ${MASTER_PROJECT})
> + option(LIBUNICODE_TOOLS "libunicode: Builds CLI tools [default: 
> ${MASTER_PROJECT}]" ${MASTER_PROJECT})
> + option(LIBUNICODE_BUILD_STATIC "libunicode: provide static library instead 
> of dynamic [default: ${LIBUNICODE_BUILD_STATIC_DEFAULT}]" 
> ${LIBUNICODE_BUILD_STATIC_DEFAULT})
> ++option(LIBUNICODE_USE_INTRINSICS "libunicode: Use SIMD extenstion during 
> text read [default: ON]" ON)
> +
> + include(ThirdParties)
> +
> Index: patches/patch-src_libunicode_CMakeLists_txt
> ===================================================================
> RCS file: patches/patch-src_libunicode_CMakeLists_txt
> diff -N patches/patch-src_libunicode_CMakeLists_txt
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_libunicode_CMakeLists_txt       13 Jul 2024 12:12:25 
> -0000
> @@ -0,0 +1,19 @@
> +From ad31f78a116c844e5c00712b3dcd258c76586e57 Mon Sep 17 00:00:00 2001
> +From: Christian Parpart <christian@parpart.family>
> +Date: Tue, 26 Dec 2023 10:07:16 +0100
> +Subject: [PATCH] Make usage of SSE extension optional
> +
> +Index: src/libunicode/CMakeLists.txt
> +--- src/libunicode/CMakeLists.txt.orig
> ++++ src/libunicode/CMakeLists.txt
> +@@ -110,6 +110,10 @@ add_library(unicode ${LIBUNICODE_LIB_MODE}
> +     codepoint_properties_names.cpp
> + )
> +
> ++if(LIBUNICODE_USE_INTRINSICS)
> ++    target_compile_definitions(unicode PRIVATE USE_INTRINSICS)
> ++endif()
> ++
> + set(public_headers
> +     capi.h
> +     codepoint_properties.h
> Index: patches/patch-src_libunicode_scan_cpp
> ===================================================================
> RCS file: patches/patch-src_libunicode_scan_cpp
> diff -N patches/patch-src_libunicode_scan_cpp
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_libunicode_scan_cpp     13 Jul 2024 12:12:25 -0000
> @@ -0,0 +1,24 @@
> +From ad31f78a116c844e5c00712b3dcd258c76586e57 Mon Sep 17 00:00:00 2001
> +From: Christian Parpart <christian@parpart.family>
> +Date: Tue, 26 Dec 2023 10:07:16 +0100
> +Subject: [PATCH] Make usage of SSE extension optional
> +
> +Index: src/libunicode/scan.cpp
> +--- src/libunicode/scan.cpp.orig
> ++++ src/libunicode/scan.cpp
> +@@ -81,6 +81,7 @@ size_t detail::scan_for_text_ascii(string_view text, s
> +     auto input = text.data();
> +     auto const end = text.data() + min(text.size(), maxColumnCount);
> +
> ++#if defined(USE_INTRINSICS)
> +     intrinsics::m128i const ControlCodeMax = intrinsics::set1_epi8(0x20); 
> // 0..0x1F
> +     intrinsics::m128i const Complex = intrinsics::set1_epi8(-128);        
> // equals to 0x80 (0b1000'0000)
> +
> +@@ -99,6 +100,7 @@ size_t detail::scan_for_text_ascii(string_view text, s
> +         }
> +         input += sizeof(intrinsics::m128i);
> +     }
> ++#endif
> +
> +     while (input != end && is_ascii(*input))
> +         ++input;
> 

-- 
SASANO Takayoshi (JG1UAA) <u...@mx5.nisiq.net>

Reply via email to