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


Jakub Jelinek wrote:
> On Mon, Jul 04, 2011 at 03:49:58PM +0200, Michael Matz wrote:
>> > But you said the operand is an int sized memory, while you expect
>> > 4 times as big data with different alignment.
>> > So you want "m"(*(__m128d *)nnnn)  (or "m"(*(__m128i *)nnnn) ).
>>
>> Right.  But even then the replacement of a memory location with a
>> constant
>> seems useless in an asm operand whose constraint requires memory.  The
>> only thing that we get out of this is some shuffling between the old and
>> some temporary memory.

  I commented on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46615
about how I patched the mpeg2dec package in mandriva.

> 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.

  The solution I used was to not declare the vector as const. It
probably is a fragile solution, but at the moment I considered
safer than attempting to patch the asm, and inserting bugs on
code I do not fully understand.

> 	Jakub

Paulo


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