From: "John S. Fine" Newsgroups: comp.os.msdos.djgpp Subject: Re: Asm question Date: Fri, 12 Feb 1999 09:57:28 -0500 Lines: 30 Message-ID: <36C44158.35A4@erols.com> References: <3 DOT 0 DOT 6 DOT 32 DOT 19990212092623 DOT 00840750 AT pop DOT netaddress DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: OgveNJuOAPWBY7ZoeoqoRUnPdXmRJIvXYt/hky1gV7U= X-Complaints-To: abuse AT rcn DOT com NNTP-Posting-Date: 12 Feb 1999 14:58:44 GMT X-Mailer: Mozilla 3.01 (Win95; U) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Paul Derbyshire wrote: > > I notice gcc zeroes eax using > > xorl %eax, %eax > > rather than > > movl $0, %eax > > Is the xorl faster or more pipelinable or something? Seems > counterintuitive. :-) The xorl is a two byte instruction, the movl is a five byte instruction. If they were the same speed then it is likely that using the shorter instruction will result in slightly faster overall execution because (averaged over several instances) it will reduce the number of cache misses. On some CPU's they simply are the same speed (before considering the cache miss issue). On other CPU's this question has generated a lot of discussion in comp.lang.asm.x86, and it seems likely that on some CPU's under some conditions the movl would be faster. (I am not certain of that). Check dejanews, if you want to read all the discussion on that topic. -- http://www.erols.com/johnfine/ http://www.geocities.com/SiliconValley/Peaks/8600/