Skip to content

Commit 117809a

Browse files
committed
mem: Add documentations for REP string insturctions
Signed-off-by: Joe Richey <[email protected]>
1 parent e42dfe7 commit 117809a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/mem/x86_64.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
use super::c_int;
22

3+
// On recent Intel processors, "rep movsb" and "rep stosb" have been enhanced to
4+
// select the best microarchitectural implementation based on length and
5+
// alignment. This allows for very fast memcmp/memset implementations.
6+
// See "Intel® 64 and IA-32 Architectures Optimization Reference Manual"
7+
// - Enhanced REP MOVSB and STOSB operation (ERMSB) (section 3.7.7)
8+
// - Fast Short REP MOV (FSRM)
9+
310
#[cfg_attr(all(feature = "mem", not(feature = "mangled-names")), no_mangle)]
411
pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8, count: usize) -> *mut u8 {
512
asm!(

0 commit comments

Comments
 (0)