logoalt Hacker News

wasmpersonyesterday at 7:29 PM0 repliesview on HN

> Array accesses take an extra instruction? Either you're in a tight loop walking a tiny array and you don't do the full offset calculation per step, or you're walking over an array in RAM and you're bottlenecked by the memory bus.

I'm not a hardware person, but whenever I look at compiler output I find computed index accesses all over the place in the assembly. This would suggest to me that at least compiler developers believe these addressing modes to be important.

> Yes, that is totally fine. Either you know your target CPU, or you don't - and then you ask your OS for details.

So then my code has to choose between being hardware-dependent or OS-dependent? That doesn't seem ideal.

> "For example, if you are writing a kernel and want it to support all RISC-V cores" - NOBODY IS DOING THAT.

I'd hate to live in a future where linux distros need to ship a separate kernel binary for every random combination of RISC-V features. That said maybe the run-time feature-detection extension will be so widely supported in practice that this wouldn't come up?