Re: long long in assembly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux