]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Add support for __attribute__((__target__(...))) to overcome limitations of -march...
authorMika Lindqvist <postmaster@raasu.org>
Fri, 22 Dec 2023 14:59:03 +0000 (16:59 +0200)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Mon, 25 Dec 2023 19:43:31 +0000 (20:43 +0100)
arch/arm/acle_intrins.h
arch/arm/crc32_acle.c
arch/arm/insert_string_acle.c
zbuild.h

index e9eef12dfb4335d210fa435ed8cf37f42cfba11f..531b8a7f66d96ce854d252469cf054a438d278c5 100644 (file)
@@ -8,6 +8,14 @@
 #  include <arm_acle.h>
 #endif
 
+#ifdef ARM_ACLE
+#if defined(__aarch64__)
+#  define Z_TARGET_CRC Z_TARGET("+crc")
+#else
+#  define Z_TARGET_CRC
+#endif
+#endif
+
 #ifdef ARM_SIMD
 #ifdef _MSC_VER
 typedef uint32_t uint16x2_t;
index 978d97d720e61e7ae4f9c5059e22e4301760db7b..ac7d6ff66b3ea703b889958e4b93ebe7296606bb 100644 (file)
@@ -6,14 +6,10 @@
 */
 
 #ifdef ARM_ACLE
-#ifdef _MSC_VER
-#  include <intrin.h>
-#else
-#  include <arm_acle.h>
-#endif
+#include "acle_intrins.h"
 #include "../../zbuild.h"
 
-Z_INTERNAL uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len) {
+Z_INTERNAL Z_TARGET_CRC uint32_t crc32_acle(uint32_t crc, const uint8_t *buf, size_t len) {
     Z_REGISTER uint32_t c;
     Z_REGISTER const uint16_t *buf2;
     Z_REGISTER const uint32_t *buf4;
index 9ac3ccb42f234f3200133713ca4e6de339ffbd34..aa8385c712e614793bfa17a06a31bdf8841010c1 100644 (file)
@@ -6,9 +6,7 @@
  */
 
 #ifdef ARM_ACLE
-#ifndef _MSC_VER
-#  include <arm_acle.h>
-#endif
+#include "acle_intrins.h"
 #include "../../zbuild.h"
 #include "../../deflate.h"
 
@@ -18,9 +16,9 @@
 #define HASH_CALC_VAR       h
 #define HASH_CALC_VAR_INIT  uint32_t h = 0
 
-#define UPDATE_HASH         update_hash_acle
-#define INSERT_STRING       insert_string_acle
-#define QUICK_INSERT_STRING quick_insert_string_acle
+#define UPDATE_HASH         Z_TARGET_CRC update_hash_acle
+#define INSERT_STRING       Z_TARGET_CRC insert_string_acle
+#define QUICK_INSERT_STRING Z_TARGET_CRC quick_insert_string_acle
 
 #include "../../insert_string_tpl.h"
 #endif
index bb964d6c0aa4dfd6e5213200133438412d3f8a9f..d78c3a15a2ae6a3e0b6a15b3868038a7ae9c6026 100644 (file)
--- a/zbuild.h
+++ b/zbuild.h
 #  endif
 #endif
 
+#ifndef Z_TARGET
+#  if Z_HAS_ATTRIBUTE(__target__)
+#    define Z_TARGET(x) __attribute__((__target__(x)))
+#  else
+#    define Z_TARGET(x)
+#  endif
+#endif
+
 /* This has to be first include that defines any types */
 #if defined(_MSC_VER)
 #  if defined(_WIN64)