Question

I'm trying to compile code which is calling multiple times the following makro:

#define MULADD(i, j) \
    asm( \
    " mullw  16,%6,%7       \n\t" \
    " addc   %0,%0,16       \n\t" \
    " mulhwu 16,%6,%7       \n\t" \
    " adde   %1,%1,16       \n\t" \
    " addze  %2,%2          \n\t" \
    :"=r"(c0), "=r"(c1), "=r"(c2):"0"(c0), "1"(c1), "2"(c2), "r"(i), "r"(j):"16");

where ever MULAD is called i get the

error: expected ')' before ':' token

error notification.

And the Error code looks like this:

../../src/math/mul.c: In function 'mul_comba':
../../src/math/mul.c:787: warning: implicit declaration of function 'asm'
../../src/math/mul.c:787: error: expected ')' before ':' token
../../src/math/mul.c: In function 'mul_comba_small':
../../src/math/mul.c:816: error: expected ')' before ':' token

I have no idea what I'm doing wrong, and what does the implicit declaration mean? As far as i know asm() is compiler reserved and so not an function that has to be declared, has it? and if so, what I had to include? I'm realy out of knowledge.

EDIT: I'm using gcc 4.2.1 the arch is as tagged powerpc (32Bit) and the OS is freeBSD 9.2

Was it helpful?

Solution

According to the C standard (appendix J.5.10), asm is a common language extension. In gcc it is disallowed (together with all gcc extensions), if you use a flag like -std=c90, -std=c99 or -ansi. If you want C99 with gcc extensions, use -std=gnu99 instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top