3 ms·
Why doesn't Intel CPUs implement a modern version of Z80's LDIR instruction (a memmove in a single instruction)? Then the kernel wouldn't have to save any regi
by silvestrov 6y ago
Why doesn't Intel CPUs implement a modern version of Z80's LDIR instruction (a memmove in a single instruction)?
Then the kernel wouldn't have to save any registers. (I'd really like if she had documented exactly which CPU/system she used for benchmarking).
- jeffbee 6y agoIntel CPUs have REP MOVS, which is basically the same thing.
- beagle3 6y agoIt's called REP MOVSB (or MOVSW, MOVSD, maybe also MOVSQ?). It has existed since the 8086 day; and for reasons I don't know, it supposedly works well for big blocks these days (>1K or so) but is supposedly slower than register moves for small blocks.
- JoshTriplett 6y ago> it supposedly works well for big blocks these days (>1K or so) but is supposedly slower than register moves for small blocks. On current processors with Fast Short REP MOVSB (FSRM), REP MOVSB is the fastest method for all sizes. On processors without FSRM, but with ERMS, REP MOVSB is faster for anything longer than ~128 bytes.
- beagle3 6y agoThanks! Is there a simple rule-of-the-thumb about when can one rely on FSRM?
- JoshTriplett 6y agoYou should check the corresponding CPUID bit, but in general, Ice Lake and newer.
- sedatk 6y agoLDIR is slower than unrolling multiple LDI instructions by the way.