Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SIMD Inlined asm code Help

18 views
Skip to first unread message

srimks11

unread,
Mar 6, 2009, 2:20:26 AM3/6/09
to
Hello All.

I have a piece of code both in C & as Inlined Assembly below -

------c code----
#include <stdio.h>

void add (float *a, float *b, float *c)
{
int i;

for (i = 0; i < 4; i++)
c[i] = a[i] + b[i];
}

int main()
{
return 0;
}
----

and Inline asm code as -

----inline asm-----
#include <stdio.h>

void add(float *a, float *b, float *c)
{
asm (".intel_syntax noprefix\n\t"
"mov eax, a\n\t"
"mov edx, b\n\t"
"mov ecx, c\n\t"
"movaps xmm0, XMMWORD PTR [eax]\n\t"
"addps xmm0, XMMWORD PTR [edx]\n\t"
"movaps XMMWORD PTR [ecx], xmm0\n\t"
);
}

int main()
{
return 0;
}
-----

The above C code was fine, no doubt on it but inline assembly code
gave below error messages as -
-----
]$ icc add-simd.c
/tmp/icc1jn4Pnas_.s: Assembler messages:
/tmp/icc1jn4Pnas_.s:50: Error: Unknown operand modifier `XMMWORD'
/tmp/icc1jn4Pnas_.s:51: Error: Unknown operand modifier `XMMWORD'
/tmp/icc1jn4Pnas_.s:52: Error: Unknown operand modifier `XMMWORD'
------

I know that I am missing something as this is the first Inline asm I
had tried writting till date, so looking for above solutions and am
using Intel C++ Compiler-v11.0 (ICC) on x86_64 linux machine.


~BR

Hendrik van der Heijden

unread,
Mar 6, 2009, 8:47:13 AM3/6/09
to
srimks11 schrieb:

> ]$ icc add-simd.c
> /tmp/icc1jn4Pnas_.s: Assembler messages:
> /tmp/icc1jn4Pnas_.s:50: Error: Unknown operand modifier `XMMWORD'

> I know that I am missing something as this is the first Inline asm I


> had tried writting till date, so looking for above solutions and am
> using Intel C++ Compiler-v11.0 (ICC) on x86_64 linux machine.

Try "icc add-simd.c -msse2" so that icc is allowed to output SSE instructions.


Hendrik vdH

srimks11

unread,
Mar 9, 2009, 8:27:07 AM3/9/09
to
On Mar 6, 6:47 pm, Hendrik van der Heijden <spamt...@crayne.org>
wrote:

Hello.

I tried doing "icc add-simd.c -msse2" both with ICC-v11.0 & ICC-v10.0,
the problem is still same. I am having Linux x86_64 m/c.

Any clue??

~BR

Maicon

unread,
Mar 11, 2009, 7:29:53 PM3/11/09
to

have you tried without the explicit "xmmword ptr" modifier? im quite
sure the compiler knows the correct data to load into xmm registers.

0 new messages