Package init
This commit is contained in:
parent
f4bd5ac7d9
commit
70f9a96743
91
0004-zlib-Optimize-CRC32.patch
Normal file
91
0004-zlib-Optimize-CRC32.patch
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
From 8935175266e343ac1d52106e2e790810b54f26c1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: liqiang64 <liqiang64@huawei.com>
|
||||||
|
Date: Tue, 3 Dec 2019 03:22:00 +0000
|
||||||
|
Subject: [PATCH] zlib: Optimize CRC32
|
||||||
|
|
||||||
|
This patch uses the NEON instruction set to optimize the CRC32
|
||||||
|
algorithm.
|
||||||
|
|
||||||
|
On the ARM architecture, we can optimize the efficiency of
|
||||||
|
crc32 through the interface provided by the neon instruction
|
||||||
|
set.
|
||||||
|
Modify by Li Qiang.
|
||||||
|
---
|
||||||
|
crc32.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 47 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/crc32.c b/crc32.c
|
||||||
|
index 9580440..79ebdbd 100644
|
||||||
|
--- a/crc32.c
|
||||||
|
+++ b/crc32.c
|
||||||
|
@@ -29,6 +29,9 @@
|
||||||
|
#endif /* MAKECRCH */
|
||||||
|
|
||||||
|
#include "zutil.h" /* for STDC and FAR definitions */
|
||||||
|
+#ifdef __aarch64__
|
||||||
|
+#include "arm_acle.h"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* Definitions for doing the crc four data bytes at a time. */
|
||||||
|
#if !defined(NOBYFOUR) && defined(Z_U4)
|
||||||
|
@@ -194,6 +197,47 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
|
||||||
|
return (const z_crc_t FAR *)crc_table;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ulg crc32_neon(crc, buf, len)
|
||||||
|
+ unsigned long crc;
|
||||||
|
+ const unsigned char FAR *buf;
|
||||||
|
+ z_size_t len;
|
||||||
|
+{
|
||||||
|
+ register uint32_t crc_result = 0xFFFFFFFFU;
|
||||||
|
+ register const uint8_t *buf1;
|
||||||
|
+ register const uint16_t *buf2;
|
||||||
|
+ register const uint32_t *buf4;
|
||||||
|
+ register const uint64_t *buf8;
|
||||||
|
+ int64_t length = (int64_t)len;
|
||||||
|
+ buf8 = (const uint64_t *)(const void *)buf;
|
||||||
|
+
|
||||||
|
+ if (buf == NULL) {
|
||||||
|
+ crc_result = 0xffffffffL;
|
||||||
|
+ } else {
|
||||||
|
+ crc_result = crc^0xffffffffUL;
|
||||||
|
+
|
||||||
|
+ while((length -= sizeof(uint64_t)) >= 0) {
|
||||||
|
+ crc_result = __crc32d((crc_result), *buf8++);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ buf4 = (const uint32_t *)(const void *)buf8;
|
||||||
|
+ if (length & sizeof(uint32_t)) {
|
||||||
|
+ crc_result = __crc32w((crc_result), *buf4++);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ buf2 = (const uint16_t *)(const void *)buf4;
|
||||||
|
+ if(length & sizeof(uint16_t)) {
|
||||||
|
+ crc_result = __crc32h((crc_result), *buf2++);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ buf1 = (const uint8_t *)(const void *)buf2;
|
||||||
|
+ if (length & sizeof(uint8_t)) {
|
||||||
|
+ crc_result = __crc32b((crc_result), *buf1);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return (crc_result ^ 0xffffffffL);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* ========================================================================= */
|
||||||
|
#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8)
|
||||||
|
#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1
|
||||||
|
@@ -204,6 +248,9 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
|
||||||
|
const unsigned char FAR *buf;
|
||||||
|
z_size_t len;
|
||||||
|
{
|
||||||
|
+ #ifdef __aarch64__
|
||||||
|
+ return crc32_neon(crc, buf, len);
|
||||||
|
+ #endif
|
||||||
|
if (buf == Z_NULL) return 0UL;
|
||||||
|
|
||||||
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: zlib
|
Name: zlib
|
||||||
Version: 1.2.11
|
Version: 1.2.11
|
||||||
Release: 15
|
Release: 16
|
||||||
Summary: A lossless data-compression library
|
Summary: A lossless data-compression library
|
||||||
License: zlib and Boost
|
License: zlib and Boost
|
||||||
URL: http://www.zlib.net
|
URL: http://www.zlib.net
|
||||||
@ -13,6 +13,7 @@ Patch0: zlib-1.2.5-minizip-fixuncrypt.patch
|
|||||||
Patch1: 0001-Neon-Optimized-hash-chain-rebase.patch
|
Patch1: 0001-Neon-Optimized-hash-chain-rebase.patch
|
||||||
Patch2: 0002-Porting-optimized-longest_match.patch
|
Patch2: 0002-Porting-optimized-longest_match.patch
|
||||||
Patch3: 0003-arm64-specific-build-patch.patch
|
Patch3: 0003-arm64-specific-build-patch.patch
|
||||||
|
Patch4: 0004-zlib-Optimize-CRC32.patch
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
BuildRequires: automake, autoconf, libtool
|
BuildRequires: automake, autoconf, libtool
|
||||||
@ -62,6 +63,7 @@ This package contains the development-related content related to minizip.
|
|||||||
export CFLAGS="$RPM_OPT_FLAGS"
|
export CFLAGS="$RPM_OPT_FLAGS"
|
||||||
%ifarch aarch64
|
%ifarch aarch64
|
||||||
CFLAGS+=" -DARM_NEON -O3"
|
CFLAGS+=" -DARM_NEON -O3"
|
||||||
|
CFLAGS+=" -march=armv8-a+crc"
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix}
|
./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix}
|
||||||
@ -113,5 +115,7 @@ make test
|
|||||||
%{_libdir}/pkgconfig/minizip.pc
|
%{_libdir}/pkgconfig/minizip.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 3 2019 liqiang <liqiang64@huawei.com> - 1.2.11-16
|
||||||
|
- Optimize CRC32 by NEON
|
||||||
* Thu Sep 5 2019 dongjian <dongjian13@huawei.com> - 1.2.11-15
|
* Thu Sep 5 2019 dongjian <dongjian13@huawei.com> - 1.2.11-15
|
||||||
- Rebuild the zlib and fix description
|
- Rebuild the zlib and fix description
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user