Writing string.h functions using string instructions in asm x86-64 (2025)

https://pmasschelier.github.io/x86_64_strings/

Article

  • Implements C string.h functions using native x86-64 string instructions.
  • Covers SCAS, MOVS, CMPS, LODS, and STOS instruction families.
  • Shows how SSE/AVX variants like pcmpestri accelerate string operations.
  • Educational deep-dive into hand-optimized low-level string handling.

Discussion

  • One commenter questions how to correctly interpret pcmpestri flags vs. ZF/SF after the instruction.

Discuss on HN


Type Link
Added Apr 21, 2026
Modified Apr 21, 2026