Inline assembly

Discuss the development of software, tools, libraries and anything else that helps make ps2dev happen.

Moderators: cheriff, Herben

Post Reply
SubZero9
Posts: 1
Joined: Sun Jun 18, 2006 4:48 pm

Inline assembly

Post by SubZero9 »

I've got a problem with the toolchain, where I'm doing something like this:

static inline void SetupMatrix (MATRIX mat)
{
asm __volatile__ ("\n\
lqc2 vf4,0x00(%0)\n\
lqc2 vf5,0x10(%0)\n\
lqc2 vf6,0x20(%0)\n\
lqc2 vf7,0x30(%0)\n\
": : "r" (mat));
}

The compiler is throwing up this error:

error: Internal compiler error at expr.c:2672

Where the line it is throwing up on is asm __volatile__ line. It is also complaining about this:

error C2143: syntax error : missing ')' before ':'

Which is referring to the ": : "r" (mat)); line

Any ideas?
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

Probably your compiler settings because I copied and pasted it into my code and it compiled perfectly.

I even used it to write my own little asm test,

Code: Select all

void AddTest()
{
int num1=5;
int num2=10;
int out=0;
asm __volatile__ ("\n\ 
mult %0,%1,%2\n\
":"=r"(out):"r"(num1),"r"(num2));
printf("Result:%d \n",out);
}
which again compiled perfectly and worked(I.e it outputted 50) so I don't think your code is at fault.
Post Reply