lkml.org 
[lkml]   [2017]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] crypto: x86/twofish-3way - Fix %rbp usage

* Ingo Molnar <mingo@kernel.org> wrote:

>
> * Eric Biggers <ebiggers3@gmail.com> wrote:
>
> > There may be a small overhead caused by replacing 'xchg REG, REG' with
> > the needed sequence 'mov MEM, REG; mov REG, MEM; mov REG, REG' once per
> > round. But, counterintuitively, when I tested "ctr-twofish-3way" on a
> > Haswell processor, the new version was actually about 2% faster.
> > (Perhaps 'xchg' is not as well optimized as plain moves.)
>
> XCHG has implicit LOCK semantics on all x86 CPUs, so that's not a surprising
> result I think.

Correction: I think XCHG only implies LOCK if there's a memory operand involved -
register-register XCHG should not imply any barriers.

So the result is indeed unintuitive.

Thanks,

Ingo

\
 
 \ /
  Last update: 2017-12-19 18:36    [W:0.193 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site