delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/10/15/19:13:28

From: peje AT irf DOT se (Per-Ola Nilsson)
Subject: Re: this is optimization?
To: OKRA AT max DOT tiac DOT net (Kimberley Burchett)
Date: Sat, 15 Oct 1994 21:23:25 +0100 (MET)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

> 
> 
>   I was going over the asm output of a program and I came across this 
> little snippet:
> 
> 	movl %eax,-4(%ebp)
> 	movl -4(%ebp),%eax
> 
>   There wasn't a label in between or anything, just this totally useless 
> instruction.  This was with -O3.
>   I've also come across silly little things like this:
> 
> 	movl %eax,%edx
> 	sall %edx,6
> 	movl %edx,%eax
 I have seen a post on comp.gcc.compilers a couple of months ago which said
 that gcc version 2.6.0 had changed its register allocation order making edx
 the primary working register. I can't check this out myself because I don't
 have the compiler sources, somebody out there maybe could check it out (DJ?).

> 
>   instead of:
> 
> 	sall %edx,6
> 	movl %eax,%edx
> 
>   Another useless instruction, but this one is a little more vague so I 
> guess I can forgive the compiler (barely).  But the first example is just 
> ridiculous!
> 							Kim
> 

Regards,
Per-Ola Nilsson
Sweden


- Raw text -


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