[lkml]   [2018]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: x86/asm: __clear_user() micro-optimization (was: "Re: [GIT PULL] x86/asm changes for v4.18")

* Linus Torvalds <> wrote:

> On Mon, Jun 4, 2018 at 5:21 AM Ingo Molnar <> wrote:
> >
> > - __clear_user() micro-optimization (Alexey Dobriyan)
> Was this actually tested?

I'm not sure - Alexey?

> I think one reason people avoided the constant was that on some
> microarchitecture it ended up being a separate uop just for the
> constant generation, because it wouldn't fit in a single uop.
> I'm pretty sure that used to be the case for P4, for example.
> Afaik there have also been issues with decoding instructions that have
> both an immediate and a memory offset.
> I suspect none of this is an issue on modern cores, but there really
> at least historically were cases where
> mov %reg,mem
> was better than
> mov $imm,mem
> if %reg already had the right value, so it's not at all 100% obvious
> that the micro-optimization really _optimizes_ anything.
> Any time people do this, they should add numbers.

Ok, fair point and agreed - if Alexey sends some measurements to back the change
I'll keep this, otherwise queue up a revert.



 \ /
  Last update: 2018-06-05 17:05    [W:0.044 / U:3.652 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site