This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Validity of __asm__ transformation with "m" reference
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.
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.
Jakub