www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/09/11:07:19

Date: Thu, 9 May 1996 18:58:32 +0400 (MSD)
From: "Alexander V. Lukyanov" <lav AT video DOT yars DOT free DOT net>
Message-Id: <199605091458.SAA16689@video.yars.free.net>
To: djgpp AT delorie DOT com, nicolas AT jupiter DOT ceng DOT cea DOT fr
Subject: Re: mov %eax, %eax in generated asm source

> From: nicolas AT jupiter DOT ceng DOT cea DOT fr (Eric NICOLAS)
> 
> >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".

No, mov does not modify flags, so it is useless for zero testing.
I would guess that gcc -O2 won't generate such a command.

- Raw text -


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