summaryrefslogtreecommitdiff
path: root/functable.c
diff options
context:
space:
mode:
authorSebastian Pop <s.pop@samsung.com>2019-01-25 11:44:46 -0600
committerHans Kristian Rosbach <hk-github@circlestorm.org>2019-03-01 11:40:23 +0100
commit1cd1b4eb0eddbe8c142d8a7223fde9bc212739dd (patch)
treee7fc953c1b6bf986d170c7e93aa93fbf4b97a39f /functable.c
parentd5480df526b5a19ee2fcfce93b8121d2cdfb70ef (diff)
ARM: check cpu feature once at init time
This makes the checks for arm cpu features as inexpensive as on the x86 side by calling the runtime feature detection once in deflate/inflate init and then storing the result in a global variable.
Diffstat (limited to 'functable.c')
-rw-r--r--functable.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/functable.c b/functable.c
index 93fbd23..91a2a20 100644
--- a/functable.c
+++ b/functable.c
@@ -10,14 +10,6 @@
#include "gzendian.h"
-#if defined(X86_CPUID)
-# include "arch/x86/x86.h"
-#elif (defined(__arm__) || defined(__aarch64__) || defined(_M_ARM))
-extern int arm_has_crc32();
-extern int arm_has_neon();
-#endif
-
-
/* insert_string */
#ifdef X86_SSE4_2_CRC_HASH
extern Pos insert_string_sse(deflate_state *const s, const Pos str, unsigned int count);
@@ -69,7 +61,7 @@ ZLIB_INTERNAL Pos insert_string_stub(deflate_state *const s, const Pos str, unsi
if (x86_cpu_has_sse42)
functable.insert_string=&insert_string_sse;
#elif defined(__ARM_FEATURE_CRC32) && defined(ARM_ACLE_CRC_HASH)
- if (arm_has_crc32())
+ if (arm_cpu_has_crc32)
functable.insert_string=&insert_string_acle;
#endif
@@ -97,7 +89,7 @@ ZLIB_INTERNAL uint32_t adler32_stub(uint32_t adler, const unsigned char *buf, si
functable.adler32=&adler32_c;
#if ((defined(__ARM_NEON__) || defined(__ARM_NEON)) && defined(ARM_NEON_ADLER32))
- if (arm_has_neon())
+ if (arm_cpu_has_neon)
functable.adler32=&adler32_neon;
#endif
@@ -120,7 +112,7 @@ ZLIB_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64
#if BYTE_ORDER == LITTLE_ENDIAN
functable.crc32=crc32_little;
# if __ARM_FEATURE_CRC32 && defined(ARM_ACLE_CRC_HASH)
- if (arm_has_crc32())
+ if (arm_cpu_has_crc32)
functable.crc32=crc32_acle;
# endif
#elif BYTE_ORDER == BIG_ENDIAN