I got erros in inline assembly code.
I can not know how to use inline assenbly code in CCS 4.2.
I tried to test a code with ARM Complier style, but I got error messages.
And I tried to test a code with GNU Complier style, but I got error messages.
How can I make a program with inline assembly?
The following is a sample code.
1. ARM compiler style
__inline int qmac(int a, short x, short y)
{
int i;
const int mask = 0x80000000;
i = x * y;
asm("adds i, i, i ");
asm("it VS ");
asm("EORVS i, mask, i, asr #31 ");
asm("adds a, a, i ");
asm("it VS");
asm("EORVS a, mask, a, asr #31 ");
return a;
}
2. GNU compiler style
__inline int qmac(int a, short x, short y)
{
int i;
const int mask = 0x80000000;
i = x * y;
asm("adds %0, %1, %2" : "=r" (i) : "r" (i), "r" (i));
asm("it VS ");
asm("eorvs %0, %1, %2, asr #31": "=r" (i): "r" (mask), "r" (i));
asm("adds %0, %1, %2": "=r" (a): "r" (a), "r" (i));
asm("it VS");
asm("eorvs %0, %1, %2, asr #31": "=r" (a): "r" (mask), "r" (a));
return a;
}