3 ms·
>why the hell isn't there an instruction in every processor to efficiently copy from arbitrary source to arbitrary destination with maximum bus efficiency? Uh,
by renox 6y ago
>why the hell isn't there an instruction in every processor to efficiently copy from arbitrary source to arbitrary destination with maximum bus efficiency?
Uh, you're not an hardware designer and it shows.. What if there's a page fault during the copy, you handle it in the CPU?
That said, have a look at RISC-V vectors instruction (not yet stable AFAIK) and ARM's SVE2: both should allow very efficient memcpy(among other things) much more easily than with current SIMD ISA.
- JoeAltmaier 6y agoDo they manage alignment? Say a source string starting at offset 3 inside a dword, to a destination at offset 1? That's the issue. Not just block copy of align register-sized memory. Page fault is irrelevant. It already can happen in block copy instructions.
- renox 6y agoNo, they don't provide alignment but they provide a way to write code once whatever the size of the implementation's vector registers. As for block copy instruction AFAIK there's no such things in RISC-V for example.
- JoeAltmaier 6y agoSo, no, they don't have anything like an arbitrary block copy that adjusts for alignment. Not surprising; nobody does. So we struggle in software, and have libraries with 11 bugs etc.