lkml.org 
[lkml]   [2021]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: how many memset(,0,) calls in kernel ?
Date
>   36:   b9 06 00 00 00          mov    $0x6,%ecx
> 3b: 4c 89 e7 mov %r12,%rdi
> 3e: f3 ab rep stos %eax,%es:(%rdi)
>
> The last line does exactly "memset(%rdi, %eax, %ecx)". Just two bytes
> for some code that modern processors are even able to optimize.

Hmmm I'd bet that 6 stores will be faster on ~everything.
'modern' processors do better than some older ones [1], but 6
writes isn't enough to get into the really fast paths.
So you'll still take a few cycles of setup.

[1] P4 netburst had a ~40 clock setup for any 'rep' operation.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

\
 
 \ /
  Last update: 2021-09-13 18:04    [W:0.051 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site