delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/09/12:45:32

From: elf AT netcom DOT com (Marc Singer)
Message-Id: <199605091637.JAA14494@netcom8.netcom.com>
Subject: Re: mov %eax, %eax in generated asm source
To: nicolas AT jupiter DOT ceng DOT cea DOT fr
Date: Thu, 9 May 1996 09:36:58 -0700 (PDT)
In-Reply-To: <4ms45t$8jv@news.cea.fr> from "Eric NICOLAS" at May 9, 96 06:43:09 am
MIME-Version: 1.0
Sender: elf AT netcom DOT com

> >Can anyone tell me the purpose of the code that is generated by
> >gcc -S fred.c
> >
> >whereby it generates
> >
> >mov %eax, %eax
> >
> >???? It seems like a time-waster to me ??
> 
> I *think* this is one of the most efficient way for testing if %eax is 
> zero without modifying it. the other way is "or %eax,%eax".

Nope.  MOV does not set conditional bits.  OR does.

We'd have to see the rest of the code to decide.  I've never seen such
code and would expect that it is either a typo, a degenerate compiler,
or a NOP.  


- Raw text -


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