Pádraig Brady <[email protected]> writes: > On 15/03/2026 04:04, Collin Funk wrote: >> * src/wc_neon.c (wc_lines_neon): Use alignas. >> --- >> src/wc_neon.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> diff --git a/src/wc_neon.c b/src/wc_neon.c >> index 00fa38b6e..571f5051c 100644 >> --- a/src/wc_neon.c >> +++ b/src/wc_neon.c >> @@ -35,7 +35,7 @@ wc_lines_neon (int fd) >> while (true) >> { >> - unsigned char neon_buf[IO_BUFSIZE]; >> + unsigned char alignas (16) neon_buf[IO_BUFSIZE]; >> ssize_t bytes_read = read (fd, neon_buf, sizeof neon_buf); >> if (bytes_read <= 0) >> return (struct wc_lines) { bytes_read == 0 ? 0 : errno, lines, >> bytes }; > > Is this for perf or does the neon code have that alignment requirement?
I think most ARM64 support fast unaligned access, but not all of them. Also, support for unaligned access might be disabled in the control register. From the documentation here [1]: Unaligned accesses to regions marked as Normal can be trapped by setting SCTLR_ELx.A. If this bit is set, unaligned accesses to Normal regions also generate alignment faults. Collin [1] https://developer.arm.com/documentation/102376/0200/Alignment-and-endianness/Alignment
