This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Validity of __asm__ transformation with "m" reference


Hi,

On Mon, 4 Jul 2011, Jakub Jelinek wrote:

> No, what you can get out of that is e.g. optimizing away otherwise unneeded
> large variable.
> Consider:
> static const int i[131072] = { 1, 2, 3, 4, 5 };
> void foo (void)
> {
>   __asm volatile ("" : : "m" (i[0]));
> }
> By giving the asm just address of an const int 1 instead of the whole array
> you can optimize the large array away.

Hmm, that's right.  If that happens often.  As soon as you use the same 
element multiple times you'll offset some of the potential savings.  I 
guess we don't take this into account, so I'm not sure if that reason is 
very convincing.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]