Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 16 Feb 2019 02:27:17 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Bruce Evans <brde@optusnet.com.au>, Alexey Dokuchaev <danfe@freebsd.org>,  src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r344118 - head/sys/i386/include
Message-ID:  <20190216022142.I2745@besplex.bde.org>
In-Reply-To: <20190215140409.GQ24863@kib.kiev.ua>
References:  <201902141353.x1EDrB0Z076223@repo.freebsd.org> <20190215071604.GA89653@FreeBSD.org> <20190215103644.GN24863@kib.kiev.ua> <20190215233444.F2229@besplex.bde.org> <20190215140409.GQ24863@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 15 Feb 2019, Konstantin Belousov wrote:

> On Sat, Feb 16, 2019 at 12:27:16AM +1100, Bruce Evans wrote:
>> On Fri, 15 Feb 2019, Konstantin Belousov wrote:
>>
>>> On Fri, Feb 15, 2019 at 07:16:04AM +0000, Alexey Dokuchaev wrote:
>>>> Is there a reason to prefer pushl+movl+popl instead of movl+xchgl?
>>> ...
>>> xchgl seems to be slower even in registers format (where no implicit
>>> lock is used).  If you can demonstrate that your fragment is better in
>>> some microbenchmark, I can change it.  But also note that its use is not
>>> on the critical path.
>>
>> The should have the same speed on modern x86.  xchgl %reg1,%reg2 is
>> not slow, but it changes 2 visible registers and a needs somwhere to
>> hold one of the registers while changing it, so on 14 year old AthlonXP
>> ...
> I think on modern Intels xchgl is implemented by renaming.  Still it is slower
> than typically highly optimized push/pops.
>
> That said, what is your preference ? My version or xchgl ?
> My own preference is to leave it as is, since it is slightly slower,
> and I do not want to spend several hours again, re-testing libc changes.

I like the push/pop instructions, so like it like it is.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190216022142.I2745>