]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Revert "[ARM/AArch64] Add run-time detection of ACLE and NEON instructions under...
authorHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 1 Nov 2018 21:18:17 +0000 (22:18 +0100)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 1 Nov 2018 21:19:34 +0000 (22:19 +0100)
This reverts commit e7e80f4cd22346a2ea3cadad57ed574078aa5576.

CMakeLists.txt
arch/aarch64/Makefile.in
arch/aarch64/armfeature.c [deleted file]
arch/aarch64/insert_string_acle.c
arch/arm/Makefile.in
arch/arm/armfeature.c [deleted file]
arch/arm/insert_string_acle.c
configure
functable.c
win32/Makefile.arm

index 9f73096cf83b710870c907f901943faf6c4c5a75..dc416e0068818995f4a5104e973d880715ccb15a 100644 (file)
@@ -424,7 +424,7 @@ else()
     message(STATUS "No optimized architecture: using ${ARCHDIR}")
 endif()
 if("${ARCH}" MATCHES "arm" OR "${ARCH}" MATCHES "aarch64")
-    set(ZLIB_ARCH_SRCS ${ZLIB_ARCH_SRCS} ${ARCHDIR}/armfeature.c ${ARCHDIR}/fill_window_arm.c)
+    set(ZLIB_ARCH_SRCS ${ZLIB_ARCH_SRCS} ${ARCHDIR}/fill_window_arm.c)
 endif()
 if(WITH_OPTIM)
     if("${ARCH}" MATCHES "arm")
index 6fcf919a93cd1ce807c3e319ae91e188f65e1a1b..3c2bebc0a33ef2a961245d6224d4420bab8eb1aa 100644 (file)
@@ -12,7 +12,7 @@ SRCDIR=.
 SRCTOP=../..
 TOPDIR=$(SRCTOP)
 
-all: adler32_neon.o adler32_neon.lo armfeature.o armfeature.lo crc32_acle.o crc32_acle.lo fill_window_arm.o fill_window_arm.lo insert_string_acle.o insert_string_acle.lo
+all: adler32_neon.o adler32_neon.lo crc32_acle.o crc32_acle.lo fill_window_arm.o fill_window_arm.lo insert_string_acle.o insert_string_acle.lo
 
 adler32_neon.o: $(SRCDIR)/adler32_neon.c
        $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
@@ -20,12 +20,6 @@ adler32_neon.o: $(SRCDIR)/adler32_neon.c
 adler32_neon.lo: $(SRCDIR)/adler32_neon.c
        $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
 
-armfeature.o: $(SRCDIR)/armfeature.c
-       $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c
-
-armfeature.lo: $(SRCDIR)/armfeature.c
-       $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c
-
 crc32_acle.o: $(SRCDIR)/crc32_acle.c
        $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c
 
diff --git a/arch/aarch64/armfeature.c b/arch/aarch64/armfeature.c
deleted file mode 100644 (file)
index 9f2af03..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#if defined(__linux__)
-# include <sys/auxv.h>
-# include <asm/hwcap.h>
-#endif
-
-int arm_has_crc32() {
-#if defined(__linux__) && defined(HWCAP_CRC32)
-  return (getauxval(AT_HWCAP) & HWCAP_CRC32) != 0 ? 1 : 0;
-#elif defined(ARM_NOCHECK_ACLE)
-  return 1;
-#else
-  return 0;
-#endif
-}
-
-int arm_has_neon()
-{
-  return 1; /* always available */
-}
index 563100b7105db77f14c9bdc92b926b3bb984c890..49f11cb35369c4ab06ff62107e2ad823d5e38650 100644 (file)
@@ -5,9 +5,10 @@
  *
  */
 
-#if defined(__ARM_FEATURE_CRC32) && defined(ARM_ACLE_CRC_HASH)
-#include <arm_acle.h>
 #include "zbuild.h"
+#ifdef __ARM_FEATURE_CRC32
+#include <arm_acle.h>
+#endif
 #include "deflate.h"
 
 /* ===========================================================================
@@ -18,6 +19,7 @@
  *    input characters and the first MIN_MATCH bytes of str are valid
  *    (except for the last MIN_MATCH-1 bytes of the input file).
  */
+#ifdef ARM_ACLE_CRC_HASH
 Pos insert_string_acle(deflate_state *const s, const Pos str, unsigned int count) {
     Pos p, lp, ret;
 
index 6fcf919a93cd1ce807c3e319ae91e188f65e1a1b..3c2bebc0a33ef2a961245d6224d4420bab8eb1aa 100644 (file)
@@ -12,7 +12,7 @@ SRCDIR=.
 SRCTOP=../..
 TOPDIR=$(SRCTOP)
 
-all: adler32_neon.o adler32_neon.lo armfeature.o armfeature.lo crc32_acle.o crc32_acle.lo fill_window_arm.o fill_window_arm.lo insert_string_acle.o insert_string_acle.lo
+all: adler32_neon.o adler32_neon.lo crc32_acle.o crc32_acle.lo fill_window_arm.o fill_window_arm.lo insert_string_acle.o insert_string_acle.lo
 
 adler32_neon.o: $(SRCDIR)/adler32_neon.c
        $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
@@ -20,12 +20,6 @@ adler32_neon.o: $(SRCDIR)/adler32_neon.c
 adler32_neon.lo: $(SRCDIR)/adler32_neon.c
        $(CC) $(SFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/adler32_neon.c
 
-armfeature.o: $(SRCDIR)/armfeature.c
-       $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c
-
-armfeature.lo: $(SRCDIR)/armfeature.c
-       $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/armfeature.c
-
 crc32_acle.o: $(SRCDIR)/crc32_acle.c
        $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/crc32_acle.c
 
diff --git a/arch/arm/armfeature.c b/arch/arm/armfeature.c
deleted file mode 100644 (file)
index 7c78dda..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#if defined(__linux__)
-# include <sys/auxv.h>
-# include <asm/hwcap.h>
-#elif defined(_WIN32)
-# include <winapifamily.h>
-#endif
-
-int arm_has_crc32() {
-#if defined(__linux__) && defined(HWCAP2_CRC32)
-  return (getauxval(AT_HWCAP2) & HWCAP2_CRC32) != 0 ? 1 : 0;
-#elif defined(ARM_NOCHECK_ACLE)
-  return 1;
-#else
-  return 0;
-#endif
-}
-
-int arm_has_neon()
-{
-#if defined(__linux__) && defined(HWCAP_NEON)
-  return (getauxval(AT_HWCAP) & HWCAP_NEON) != 0 ? 1 : 0;
-#elif defined(_M_ARM) && defined(WINAPI_FAMILY_PARTITION)
-# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
-  return 1; /* Always supported */
-# endif
-#endif
-
-#if defined(ARM_NOCHECK_NEON)
-  return 1;
-#else
-  return 0;
-#endif
-}
index 563100b7105db77f14c9bdc92b926b3bb984c890..49f11cb35369c4ab06ff62107e2ad823d5e38650 100644 (file)
@@ -5,9 +5,10 @@
  *
  */
 
-#if defined(__ARM_FEATURE_CRC32) && defined(ARM_ACLE_CRC_HASH)
-#include <arm_acle.h>
 #include "zbuild.h"
+#ifdef __ARM_FEATURE_CRC32
+#include <arm_acle.h>
+#endif
 #include "deflate.h"
 
 /* ===========================================================================
@@ -18,6 +19,7 @@
  *    input characters and the first MIN_MATCH bytes of str are valid
  *    (except for the last MIN_MATCH-1 bytes of the input file).
  */
+#ifdef ARM_ACLE_CRC_HASH
 Pos insert_string_acle(deflate_state *const s, const Pos str, unsigned int count) {
     Pos p, lp, ret;
 
index 9a6d7683130b6619ad497d77fb2336abce47c567..61c6282c69c78a145734e1c724bb5d355f4e6cf1 100755 (executable)
--- a/configure
+++ b/configure
@@ -959,8 +959,8 @@ case "${ARCH}" in
     arm | armv[3467]l | armv4b | armv4tl | armv5tel | armv5tejl | armv[67]hl | armv7hnl | armv[78]-a | armv8-a+* | armv8.[1234]-a | armv8.[1234]-a+*)
         [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=arm
         ARCHDIR=arch/arm
-        ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} armfeature.o fill_window_arm.o"
-        ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} armfeature.lo fill_window_arm.lo"
+        ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} fill_window_arm.o"
+        ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} fill_window_arm.lo"
 
         GCC_MACHINE=$(${CC} -dumpmachine)
         case "${GCC_MACHINE}" in
@@ -1064,8 +1064,8 @@ case "${ARCH}" in
     aarch64)
         [ ! -z $CROSS_PREFIX ] && QEMU_ARCH=aarch64
         ARCHDIR=arch/aarch64
-        ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} armfeature.o fill_window_arm.o"
-        ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} armfeature.lo fill_window_arm.lo"
+        ARCH_STATIC_OBJS="${ARCH_STATIC_OBJS} fill_window_arm.o"
+        ARCH_SHARED_OBJS="${ARCH_SHARED_OBJS} fill_window_arm.lo"
 
         if test $native -eq 0; then
           ARCH="armv8-a"
index 93fbd23d4d03e94cf43aca6cd111895cacaacb61..e0f0e40ce8dae152a090f13efd6280626f0bdc95 100644 (file)
@@ -12,9 +12,6 @@
 
 #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
 
 
@@ -68,8 +65,7 @@ ZLIB_INTERNAL Pos insert_string_stub(deflate_state *const s, const Pos str, unsi
     #ifdef X86_SSE4_2_CRC_HASH
     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())
+    #elif defined(ARM_ACLE_CRC_HASH)
         functable.insert_string=&insert_string_acle;
     #endif
 
@@ -97,7 +93,6 @@ 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())
         functable.adler32=&adler32_neon;
     #endif
 
@@ -118,10 +113,10 @@ ZLIB_INTERNAL uint32_t crc32_stub(uint32_t crc, const unsigned char *buf, uint64
 
     if (sizeof(void *) == sizeof(ptrdiff_t)) {
 #if BYTE_ORDER == LITTLE_ENDIAN
-      functable.crc32=crc32_little;
-#  if __ARM_FEATURE_CRC32 && defined(ARM_ACLE_CRC_HASH)
-      if (arm_has_crc32())
+#  if __ARM_FEATURE_CRC32
         functable.crc32=crc32_acle;
+#  else
+        functable.crc32=crc32_little;
 #  endif
 #elif BYTE_ORDER == BIG_ENDIAN
         functable.crc32=crc32_big;
index 656e4cf34adec6cbaf0fed3667770d4f81dcdd78..2ffb725cdad21646b0151697b962a340717c38a0 100644 (file)
@@ -37,7 +37,7 @@ WITH_VFPV3 =
 NEON_ARCH = /arch:VFPv4
 SUFFIX =
 
-OBJS = adler32.obj armfeature.obj compress.obj crc32.obj deflate.obj deflate_fast.obj deflate_slow.obj \
+OBJS = adler32.obj compress.obj crc32.obj deflate.obj deflate_fast.obj deflate_slow.obj \
        functable.obj infback.obj inflate.obj inftrees.obj inffast.obj match.obj trees.obj uncompr.obj zutil.obj fill_window_arm.obj
 !if "$(WITH_GZFILEOP)" != ""
 WFLAGS = $(WFLAGS) -DWITH_GZFILEOP
@@ -61,7 +61,7 @@ NEON_ARCH = /arch:VFPv3
 !endif
 !if "$(WITH_NEON)" != ""
 CFLAGS = $(CFLAGS) $(NEON_ARCH)
-WFLAGS = $(WFLAGS) -D__ARM_NEON__=1 -DARM_NEON_ADLER32 -DARM_NOCHECK_NEON
+WFLAGS = $(WFLAGS) -D__ARM_NEON__=1
 OBJS = $(OBJS) adler32_neon.obj
 !endif