Article View: comp.arch
Article #185Re: Performance of xchg reg,reg
From: Michael S
Date: Sun, 18 Oct 2026 15:43
Date: Sun, 18 Oct 2026 15:43
39 lines
3314 bytes
3314 bytes
On Sun, 18 Oct 2026 15:08:23 GMT
anton@mips.complang.tuwien.ac.at (Anton Ertl) wrote:
> MitchAlsup <user5857@newsgrouper.org.invalid> writes:
> >cross@spitfire.i.gajendra.net (Dan Cross) posted:
> >> What I'm saying is that, as written, the bits in the `LOCK`
> >> description above _could_ be interpreted to mean that _any_
> >> `XCHG` will always assert the `LOCK#` signal, including an
> >> `XCHG` that does not touch memory at all. The "Why?" was
> >> rhetorical, as in, "Why would the system do that?" For example,
> >> if one wrote, `xchg %ecx, %eax`, why should that assert `LOCK#`?
> >> Truly I don't know, and I was just speculating.
> >
> >Writing high quality documentation is fundamentally hard.
>
> I don't think that's the issue here. They just did not limit the
> sentence "The XCHG instruction always asserts the LOCK# signal
> regardless of the presence or absence of the LOCK prefix." to XCHG
> instructions with memory operands. That would be easy to fix, but
> they did not. And Chris M. Thomasson understood it as including
> XCHG reg, reg.
>
> My guess is that it is easy to fix in principle, but you have to deal
> with all kinds of red tape for such a fix, so unless there is good
> reason, you don't do it.
>
Frankly, I don't understand what both you and Dan Cross are talking
about.
I don't see how sentence from Intel's manual ("If a memory operand is
referenced, the processor’s locking protocol is automatically
implemented for the duration of the exchange operation, regardless of
the presence or absence of the LOCK prefix or of the value of the IOPL")
or sentence from AMD's manual ("If either operand references memory,
the processor locks automatically, whether or not the LOCK prefix is
used and independently of the value of IOPL.") can be pssibly
misunderstood.
Technical Details
Message-ID:
<20261018184318.00000bee@yahoo.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<2026Oct13.104347@mips.complang.tuwien.ac.at> <11au1vu$3ks5m$2@dont-email.me> <11aunpn$8c6$1@reader2.panix.com> <1792257076-5857@newsgrouper.org> <11b0bd3$b5b$1@reader2.panix.com> <1792265982-5857@newsgrouper.org> <2026Oct18.170823@mips.complang.tuwien.ac.at>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.arch Subject: Re: Performance of xchg reg,reg Date: Sun, 18 Oct 2026 18:43:18 +0300 Organization: A noiseless patient Spider Lines: 39 Message-ID: <20261018184318.00000bee@yahoo.com> References: <2026Oct13.104347@mips.complang.tuwien.ac.at> <11au1vu$3ks5m$2@dont-email.me> <11aunpn$8c6$1@reader2.panix.com> <1792257076-5857@newsgrouper.org> <11b0bd3$b5b$1@reader2.panix.com> <1792265982-5857@newsgrouper.org> <2026Oct18.170823@mips.complang.tuwien.ac.at> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Date: Sun, 18 Oct 2026 15:43:27 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1262206"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Cq1zmyJ8ZLzq4SRG79JvJJHmJ9rjxsT0="; posting-host="f3ba9e4a06adc8c40e079351cfd7a0db" Cancel-Lock: sha1:0yZZ9lQOw1c6HtiP0834GToAxPg= sha256:/gTBCBdKvGOHqO4CrmE9PCozpBVw5FzgWa+1V372KTw= sha1:xEi0Vg1Lga5+2CyWj2mVfXyIjrY= sha256:1s+029ArinRi/p+uXbLqZq7yOl8I1Se7/pUQGHMmwEM= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)