long long in assembly
Fabiano Ramos
ramos_fabiano@yahoo.com.br
Thu Sep 16 13:53:00 GMT 2004
Yes. Thanks a lot. I am new to gcc, to -S was unkown to me. :(
On Thursday 16 September 2004 10:44, you wrote:
> Hi!
>
> >I am trying to increment a 64-bit counter in assembly code.
> >In fact, it is a variable "unsigned long long" from C code, and
> >I am trying to increment it from a function written in assembly.
>
> You can inspect the assembly code generated by gcc with the -S option.
>
> Compiling this simple program
>
> int main()
> {
> unsigned long long a = 1234;
> a++;
>
>
> return a;
> }
>
> yields (only relevant lines)
>
> .loc 1 5 0
> movl $1234, -8(%ebp)
> movl $0, -4(%ebp)
> .loc 1 6 0
> leal -8(%ebp), %eax
> addl $1, (%eax)
> adcl $0, 4(%eax) // <- This should be what you are looking for
> .loc 1 9 0
> movl -8(%ebp), %eax
>
> greets
> cm
More information about the Gcc-help
mailing list