lkml.org 
[lkml]   [1996]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectWhat's the reason for patch to __xchg() in system.h for 1.3.83?
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)));
break;

[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
registers.

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

Tom.


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.035 / U:0.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site