File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 11use super :: c_int;
22
3+ // On most modern Intel and AMD processors, "rep movsq" and "rep stosq" have
4+ // been enhanced to perform better than an simple qword loop, making them ideal
5+ // for implementing memcpy/memset.
6+ //
7+ // On certain recent Intel processors, "rep movsb" and "rep stosb" have been
8+ // further enhanced to automatically select the best microarchitectural
9+ // implementation based on length and alignment.
10+ // See "Intel® 64 and IA-32 Architectures Optimization Reference Manual"
11+ // - Enhanced REP MOVSB and STOSB operation (ERMSB) (section 3.7.7)
12+ // - Fast Short REP MOV (FSRM)
13+ // However, to avoid run-time feature detection, we don't use these byte-based
14+ // instructions for most of the copying, instead using the qword variants.
15+
316#[ cfg_attr( all( feature = "mem" , not( feature = "mangled-names" ) ) , no_mangle) ]
417pub unsafe extern "C" fn memcpy ( dest : * mut u8 , src : * const u8 , count : usize ) -> * mut u8 {
518 asm ! (
You can’t perform that action at this time.
0 commit comments