3 ms·
>unoptimized memcpy could anyone do any better on 68000? My incomplete history of CPU dedicated fast paths for moving data: - 1982 Intel 186/286 'rep movsw' a
by rasz 2y ago
>unoptimized memcpy
could anyone do any better on 68000? My incomplete history of CPU dedicated fast paths for moving data:
- 1982 Intel 186/286 'rep movsw' at theoretical 2 cycles per byte (I think its closer to 4 in practice). Brilliant, then intel drops the ball for 20 years :|
- 1986 WDC W65C816 Move Memory Negative (MVN), Move Memory Positive (MVP) at hilarious 7 cycles per byte. Slower than unrolled code, 2x slower than unrolled code using 0 page. Afaik no loop buffer meant its re-fetching whole instruction every loop.
- 1987 NEC TurboGrafx-16/PC Engine 6502 clone by HudsonSoft HuC6280 Transfer Alternate Increment (TAI), Transfer Increment Alternate (TIA), Transfer Decrement Decrement (TDD), Transfer Increment Increment (TII) at hysterical 6 cycles per byte plus 17 cycles startup. (17 + 6x) = ~160KB/s at 7.16 MHz CPU. For comparison IBM XT with 4.77 MHz NEC V20 does >300KB/s
- 1993 Pentium 'rep movsd' at theoretical 4 bytes per cycle, 0.31 cycles per byte in practice http://www.pennelynn.com/Documents/CUJ/HTML/14.12/DURHAM1/DURHAM.HTM http://www.pennelynn.com/Documents/CUJ/HTML/14.12/DURHAM1/DU...
- 1995 Pentium Pro "fast string mode" strongly hinted at REP MOVS as the optimal way to copy memory.
- 1997 Pentium MMX 'rep movsd' 0.27 cycles per byte. Mem copy with MMX registers 0.29 cycles per byte.
- 2000 SSE2 optimized copy hack.
- 2008 AVX optimized copy hack at ~full L2/memory bus speed for large enough transfers.
- 2012 Ivy Bridge Enhanced REP MOVSB (ERMSB), but funnily still slower than even the SSE2 variants.
- 2019 Ice Lake Fast Short REP MOVSB (FSRM) still somewhat slower than AVX variants on unaligned accesses.
- 2020 Zen3 FSRM !20 times! slower than AVX unaligned, 30% slower on aligned https://lunnova.dev/articles/ryzen-slow-short-rep-mov/ https://lunnova.dev/articles/ryzen-slow-short-rep-mov/
- 2023 And then Intel got Reptar https://lock.cmpxchg8b.com/reptar.html https://lock.cmpxchg8b.com/reptar.html :)