From: Vik Heyndrickx Newsgroups: comp.os.msdos.djgpp Subject: Re: assembly language Date: Wed, 26 Aug 1998 15:51:51 +0200 Organization: University of Ghent, Belgium Lines: 24 Message-ID: <35E412F7.7839@rug.ac.be> References: <01J10IURTRN694HU4A AT SLU DOT EDU> NNTP-Posting-Host: eduserv1.rug.ac.be Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk GAMMELJL AT SLU DOT EDU wrote: > > Thanks to those who responded to my query about > movl $0x0,%edx vs xorl %edx,%edx > The movl sets %edx to zero, whereas xorl sets %edx and the carry bit to > zero. Thus the two statements above are not exactly the same thing. > This fact could make little difference to all but a few programmers, > and those few probably already know to avoid the xorl command when > writing codes in assembly language. I find that the movl command > results in faster executables even when xorl can be used as above > (in those cases in which the carry bit does not matter). Have you checked if indeed the carry flag (or ZF, OF, AF) influenced the the result? It most probably does, but you never know for sure :-( Unless the xorl is used in a loop that is repeated millions of times in your program replacing xorl with movl is probably not a superb idea, since xorl is encoded with only 2 bytes whereas movl takes 5 bytes, and they nearly execute in the same time (approx. 0 s). -- \ Vik /-_-_-_-_-_-_/ \___/ Heyndrickx / \ /-_-_-_-_-_-_/ Knight in the Order of the Unsigned Types