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
> 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
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
have you tried without the explicit "xmmword ptr" modifier? im quite
sure the compiler knows the correct data to load into xmm registers.