Re: [linux-audio-dev] [i686] xmm regs + gcc inline assembly

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] [i686] xmm regs + gcc inline assembly
From: Simon Jenkins (sjenkins_AT_blueyonder.co.uk)
Date: Fri Feb 13 2004 - 00:00:51 EET


Tim Goetze wrote:

>can anybody help out with gcc inline assembly syntax applied to sse
>registers/memory locations?
>
>for a simplified example, i'm using
>
> float t[4];
> ...
> asm ("movaps %%xmm1, %0" : : "m" (t[0]));
>
>to move 4 packed floats from xmm1 into 't'.
>
I couldn't get this to fail in practice - though I didn't
try all that hard - unless t isn't on a 16 byte boundary
in which case it segfaults.

In theory however your code is telling the compiler that
array element t[0] is in memory from which the instruction
reads. It should be more like:

    asm ("movaps %%xmm1 %0" : "=m" (t) );

which now tells the compiler that the entire array t
is in memory to which the instruction writes. This
*ought* to discourage the optimiser from doing
anything too drastic. (Maybe/AFAIK/IANAL/etc).

Simon Jenkins
(Bristol, UK)


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Feb 12 2004 - 22:58:33 EET