Article View: comp.arch
Article #197Re: Performance of xchg reg,reg
From: MitchAlsup
Date: Sun, 18 Oct 2026 18:01
Date: Sun, 18 Oct 2026 18:01
49 lines
3414 bytes
3414 bytes
Michael S <already5chosen@yahoo.com> posted:
> 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.
Look at it from the perspective of the guy verifying that on-die
interconnect is being used correctly by the cores. {{not every
designer is inside the core !!}}
Say protocol has space for XCHG-Lock and XCHG-without, and the cores
are using later instead of former because the destination does not
need the -lock part to be ATOMIC.
>
>
Technical Details
Message-ID:
<1792346478-5857@newsgrouper.org>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!newsgrouper.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> <20261018184318.00000bee@yahoo.com>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!newsgrouper.org!.POSTED!not-for-mail From: MitchAlsup <user5857@newsgrouper.org.invalid> Newsgroups: comp.arch Subject: Re: Performance of xchg reg,reg 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> <20261018184318.00000bee@yahoo.com> Date: Sun, 18 Oct 2026 18:01:18 GMT Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-ID: <1792346478-5857@newsgrouper.org> Injection-Info: newsgrouper.org; mail-complaints-to="newsgrouper@yahoo.com"; posting-account=user5857 Injection-Date: Sun, 18 Oct 2026 18:01:18 GMT User-Agent: Newsgrouper/0.9.0