News for hackers. Stuff that matters.
Re:tolower() in bulk at speed by dragontamer on Monday June 27, 2022 @06:46PM (#31901905)
> The issue of loading into your vector register... well, there are some dirty tricks for that.

Good discussion. I think the only method you haven't talked about is the simple "unaligned load" instructions (which might be the simplest, and most portable way, to do this). I know that ARM and x86 both can do unaligned loads no problem, but at a possible performance penalty.

Re:tolower() in bulk at speed by dietrichepp on Monday June 27, 2022 @08:01PM (#31902497)
The reason I didn’t mention unaligned load is because it can cross a page boundary and fault. With aligned loads, you can avoid this.

(Edit: The idea is that with an aligned load, you only load 16-byte blocks that contain valid data. This can’t page fault, but you can load data you didn’t want, which is ok. Writing is trickier because the write may have to be atomic and can’t spill.)

Re:tolower() in bulk at speed by zen_1 on Monday June 27, 2022 @09:45PM (#31903196)
Another (admittedly quite niche) gotcha I've experienced with aarch64 unaligned SIMD loads specifically is that they will fail (raising a data abort exception) if they access memory that isn't specifically designated as "normal ram" by the MMU.

This can happen if you're writing code for an embedded system, or even if you're calling memcpy with a too-smart-for-it's-own-good libc (such as Newlib, that ships with the aarch64-none-elf toolchain ARM provides...) implementation without first setting the MMU up.