Re: nasm over gas?

From: Pavel Machek
Date: Thu Sep 11 2003 - 03:18:39 EST


Hi!

> A random example form one small unrelated program (gcc 3.2):
>
> main:
> pushl %ebp
> pushl %edi
> pushl %esi
> pushl %ebx
> subl _32, %esp
> xorl %ebp, %ebp
> cmpl _1, 52(%esp)
> movl _0, 20(%esp)
> movl _1000000, %edi <----
> movl _1000000, 16(%esp) <----
> movl _0, 12(%esp)
> movl _.LC27, 8(%esp)
> je .L274
> movl _1, %esi
> cmpl 52(%esp), %esi
> jge .L272
>
> No sane human will do that.
>
> main:
> pushl %ebp
> pushl %edi
> pushl %esi
> pushl %ebx
> subl _32, %esp
> xorl %ebp, %ebp
> cmpl _1, 52(%esp)
> movl _0, 20(%esp)
> movl _1000000, %edi
> movl %edi, 16(%esp) <-- save 4 bytes
> movl %ebp, 12(%esp) <-- save 4 bytes
> movl _.LC27, 8(%esp)

Hmm, but gcc version is likely faster. No sane person would write
multiply by 5 using single lea instruction, yet gcc will do that...
Pavel
--
Pavel
Written on sharp zaurus, because my Velo1 broke. If you have Velo you don't need...

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/