On 2026-08-25 04:42, [email protected] wrote:
This patch defines UNALIGNED_OK when building for RISC-V targets that
advertise efficient misaligned accesses via __riscv_misaligned_fast or
__riscv_zicclsm.
Thanks for the info. The RISC-V insn set manual Zicclsm section[1] suggests,
though, that __riscv_zicclsm merely means unaligned loads work, not that the
loads are fast. It could be that the loads are implemented via traps.
So I installed the attached more-conservative patch. I hope it works well
enough for you. If not, please let us know.
[1]: https://riscv.github.io/riscv-isa-manual/snapshot/spec/#ext:zicclsm
From 5f46f089677db10ef3afafd8c041ae69edcf5930 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Tue, 25 Aug 2026 16:39:31 -0700
Subject: [PATCH] gzip: unaligned access if __riscv_misaligned_fast
Optimization suggested by Huang Shangcheng (Bug#81705).
* tailor.h (UNALIGNED_OK) [__riscv_misaligned_fast]:
Define if not already defined.
---
tailor.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tailor.h b/tailor.h
index 17f82b9..b943292 100644
--- a/tailor.h
+++ b/tailor.h
@@ -148,6 +148,10 @@
# define OS_CODE 0x0a
#endif
+#if defined __riscv_misaligned_fast && !defined UNALIGNED_OK
+# define UNALIGNED_OK
+#endif
+
#ifndef SIGPIPE
# define SIGPIPE 0
#endif
--
2.53.0