Re: Optimization and inline assembly in GCC 4.0/MIPS

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

 



Simon Kagstrom <simon.kagstrom@xxxxxx> writes:

> 	   : "=r" (__v0) \
> 	   : "r"(a), "r"(b), \
> 	     "i" (__NR_##name) \

You've told gcc that the inline assembler code cares about the value
of 'm', but you haven't told it that it cares about the value of
'm[0]', 'm[1]', etc.

This exact case is covered in the documentation:

    Note that in the following example the memory input is necessary,
    otherwise GCC might optimize the store to x away:

     int foo ()
     {
       int x = 42;
       int *y = &x;
       int result;
       asm ("magic stuff accessing an 'int' pointed to by '%1'"
             "=&d" (r) : "a" (y), "m" (*y));
       return result;
     }

Ian

[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