What's the reason for patch to __xchg() in system.h for 1.3.83?

Tom May (ftom@netcom.com)
Sun, 7 Apr 1996 15:17:10 -0700

I noticed patch-1.3.83 contains the following:

--- v1.3.82/linux/include/asm-i386/system.h Tue Apr 2 13:32:22 1996
+++ linux/include/asm-i386/system.h Wed Apr 3 11:25:40 1996
@@ -199,17 +199,17 @@
switch (size) {
case 1:
__asm__("xchgb %b0,%1"
- :"=q" (x), "=m" (*__xg(ptr))
+ :"=&q" (x), "=m" (*__xg(ptr))
:"0" (x), "m" (*__xg(ptr)));

[similar cases snipped]

I would like to know whether gcc actually generates incorrect code
when "=q" is used; can somebody point out a particular source file
that breaks or send a small example?

I actually believe the "&" is unnecessary for two reasons:

1. It tells gcc not to use the same register for both an output and an
(unrelated) input operand, but then input operand 0 is manually
overlapped with output operand 2.

2. The "&" should only be necessary for multi-instruction __asm__
constructs such as the following silly example, where the "&" is
necessary to ensure that %0 and %2 are assigned to different

__asm__("movl %1,%0\n\t"
"addl %2,%0"
:"=&r" (sum)
:"r" (input1), "r" (input2));