delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/20/04:00:48

From: eplmst AT lu DOT erisoft DOT se (Martin Stromberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: inline assembly syntax for accessing variables ?
Date: 20 Dec 2002 08:34:23 GMT
Organization: Ericsson Erisoft AB, Sweden
Lines: 20
Message-ID: <atukmf$ngm$1@antares.lu.erisoft.se>
References: <atses9$d2v$1 AT news DOT online DOT de> <attfnk$u3j$1 AT news DOT online DOT de>
NNTP-Posting-Host: lws256.lu.erisoft.se
X-Newsreader: TIN [version 1.2 PL2]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Lars O. Hansen (lars DOT o DOT hansen AT gmx DOT de) wrote:
: Or is using XCHG for variable swapping instead of direct translation of
: int tmp;
: tmp=a;
: a=b;
: b=tmp;
: part of djgpps optimization routines?

Why don't you "gcc -Wall -O2 -S tst.c" and check the assembly. Then
try with "-O3" and even higher if your version of gcc supports them.

: Or is XCHG a "mnemonic macro" itself or are there reasons not to use XCHG or pay speacial attention
: to sth. when using it?

It's a proper CPU instruction on IA32. There might be locking issues.


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019