porting an inline Intel assembly code with MMX technology into linux
Dear All,
I am running the code in UBUNTU Operating System.
I am porting a c code which contains inline Intel Assembly for MMX/SSE technology. Since I am new to Linux and not fully aware of the features of gcc as well as GAS assembler. I have two querries?
1. Is there any converter which will automatically convert inline assembly code written for INTEL architecture to extended inline asm for gcc?
2. While I was running a small piece of code containing extended inline assembly for MMX instructions in gcc, I got the following errors?
unknown register name ‘%xmm0’ in ‘asm if I am using xmm0 registers and
unknown register name ‘%mm0’ in ‘asm if I am using mm0 register.
Can anyone tell me whether I need to include any header file to solve this error?
The code is given below:
char X[8] = {0, 1, 2, 3, 4, 5, 6, 7};
char Y[8] = {8, 9, 10, 11, 12, 13, 14, 15}, R[8] = {0};
__asm__("movq (%[a]), %%mm0\n\t"
"movq (%[b]), %%mm1\n\t"
"pavgb %%mm0, %%mm1\n\t"
"movq %%mm1, (%[R])\n\t"
: [R] "=m" (*R)
: [a] "r" (X), [b] "r" (Y)
:"%mm0", "%mm1"
);
Thanks in advance
Last edited by arienashwani; 03-05-2009 at 10:11 PM.
Reason: Forgot to mention the name of OS on which I am running the code
|