All of lore.kernel.org
 help / color / mirror / Atom feed
From: Momchil Velikov <velco@fadata.bg>
To: Jan-Benedict Glaw <jbglaw@microdata-pos.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: xchg and GCC's optimisation:-(
Date: 17 Dec 2001 15:18:45 +0200	[thread overview]
Message-ID: <87wuzmq91m.fsf@fadata.bg> (raw)
In-Reply-To: <20011217134526.A31801@microdata-pos.de>
In-Reply-To: <20011217134526.A31801@microdata-pos.de>

>>>>> "Jan-Benedict" == Jan-Benedict Glaw <jbglaw@microdata-pos.de> writes:
Jan-Benedict> I've looked at ./include/asm-i386/system.h which does some black
Jan-Benedict> magic with it, and I don't really understand that. However, the
Jan-Benedict> result is that the xchg gets optimized away, rendering at least

Can you try with this patch ...

--- system.h.orig.0	Mon Dec 17 15:03:38 2001
+++ system.h	Mon Dec 17 15:16:58 2001
@@ -205,21 +205,15 @@ static inline unsigned long __xchg(unsig
 	switch (size) {
 		case 1:
 			__asm__ __volatile__("xchgb %b0,%1"
-				:"=q" (x)
-				:"m" (*__xg(ptr)), "0" (x)
-				:"memory");
+				     :"+q" (x),"=m" (*__xg(ptr)));
 			break;
 		case 2:
 			__asm__ __volatile__("xchgw %w0,%1"
-				:"=r" (x)
-				:"m" (*__xg(ptr)), "0" (x)
-				:"memory");
+				     :"+r" (x),"=m" (*__xg(ptr)));
 			break;
 		case 4:
 			__asm__ __volatile__("xchgl %0,%1"
-				:"=r" (x)
-				:"m" (*__xg(ptr)), "0" (x)
-				:"memory");
+				     :"+r" (x), "=m" (*__xg(ptr)));
 			break;
 	}
 	return x;

  reply	other threads:[~2001-12-17 13:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-17 12:45 xchg and GCC's optimisation:-( Jan-Benedict Glaw
2001-12-17 13:18 ` Momchil Velikov [this message]
2001-12-17 13:55   ` Jan-Benedict Glaw
2001-12-17 17:33 ` vda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wuzmq91m.fsf@fadata.bg \
    --to=velco@fadata.bg \
    --cc=jbglaw@microdata-pos.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.