views:

373

answers:

1

Hi,

I read the different topics that deal with that kind of problem, but I still have no answer. Here is my problem :

In my header file, i have this :

  int cl, ch, _a = a, _b = b;\
  __asm__ ("smull %0, %1, %2, %3\n"   
   "mov %0, %0, lsr %4\n"   
   "orr %0, %0, %1, lsl %5\n"   
   : "=&r" (cl), "=&r" (ch)   
   : "r" (_a), "r" (_b), "i" (r), "i" (32-(r)));
  cl; })

In my project settings, I verified that these following options was ckecked link text

But I have a console error :

{standard input}:242:selected processor doesn't support -- smull r0,r1,r2,r3' {standard input}:244:unshifted register required -- orr r0,r0,r1,lsl#20'

Could you help me ?

+3  A: 

Are you compiling the file for arm? By default code for the iPhone is compiled for thumb (which is usually preferable unless you are doing floating point math). The ASM you listed is arm. You will need to set any file that uses that header to compile as arm, since GCC does not allow you to switch backends inside a single compilation unit. You can change it by deselecting "Compile for Thumb" under "GCC 4.x Code Generation."

Compiling your entire project as arm will most likely have a significant (negative) impact on memory usage, and by proxy performance. Including ASM via a macro in a header like that is going to prove very messy on the iPhone. In general you are better off putting all your ASM in a single file and compiling that one file as arm, but for what is only a 3 instruction sequence that will probably not be worth while either.

Louis Gerbarg