This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
3.0 Changes in ASM
- To: gcc at gcc dot gnu dot org
- Subject: 3.0 Changes in ASM
- From: Bill Wendling <wendling at ncsa dot uiuc dot edu>
- Date: Sun, 18 Feb 2001 03:28:52 -0600
Hi all,
I was wondering about the changes in the assembly language for the
following C code:
#include <stdio.h>
int main(void)
{
printf("hello world\n");
return 0;
}
GCC 2.95.2 outputs the following asm code:
main:
pushl %ebp
movl %esp,%ebp
subl $8,%esp
addl $-12,%esp
pushl $.LC0
call printf
addl $16,%esp
xorl %eax,%eax
jmp .L2
.p2align 4,,7
.L2:
movl %ebp,%esp
popl %ebp
ret
while 3.0 outputs:
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
subl $12, %esp
pushl $.LC0
call printf
addl $16, %esp
movl $0, %eax
movl %ebp, %esp
popl %ebp
ret
The question is, why the "movl $0, %eax" when an "xor" is typically
faster (or so I'm lead to believe)?
--
|| Bill Wendling wendling@ncsa.uiuc.edu
|| Coding Simian