0

I am using inline assembly for iphone, I working for device debug mode.

The instruction is as follows:

__asm__("smlatb %0, %1, %2 ,%3 \n\t": "=r"(Temp): "r"(treg5) : "r"(fac5) : "r"(Temp) );

And I am getting an errors:

error : expected ')' before tokedn '(' error: unknown register name 'r' in 'asm'

I am using X-code 3.0 and gcc 4.0. Any ideas?

Nils Pipenbrinck
  • 83,631
  • 31
  • 151
  • 221
Manish
  • 417
  • 1
  • 6
  • 14

5 Answers5

1

There should only be three colons, not four.

The arguments following the first colon specify the inputs, then the outputs, then the clobber list.

If you have multiple parameters you can use a comma to separate them rather then colon.

In your example. I assume, that temp is your output and treg5, fac5 are your inputs. You probably want something like this.

__asm__("smlatb %0, %1, %2, %0 \n\t"
        : "=r"(Temp) 
        : "0"(Temp), "r"(treg5), "r"(fac5)
        :);

Btw, there are some good examples of iphone ARM assembly in the vfpmath library.

hyperlogic
  • 7,525
  • 7
  • 39
  • 32
0

one correction the instruction is asm("smlatb %0, %1, %2 ,%3 \n\t": "=r"(Temp): "r"(treg5) : "r"(fac5) : "r"(Temp) );

Manish
  • 417
  • 1
  • 6
  • 14
0

I believe you should be doing something like this:

__asm__("smlatb %0, %1, %2 ,%3 \n\t": "=r"(Temp): "r"(treg5) : "r"(fac5) : "r"(Temp));

See this Stack Overflow question for details.

Community
  • 1
  • 1
Naaff
  • 9,213
  • 3
  • 38
  • 43
  • Hi I have done that ie added 2 underscore characters before and after asm still I am getting same error. – Manish May 05 '09 at 06:00
0

I added codewarrior style inline assembly __asm{
smlatb Temp, treg5, fac5 ,Temp } and in prject settings under build tab under GCC 4.0 language I selected the option Allow CodeWarrior-Style Inline Assembly also selected allow 'asm' 'inline' 'typeof' options and the code worked finally

Manish
  • 417
  • 1
  • 6
  • 14
0

You have got too many : (colons). They are used as separators. So, you should have one to separate the assembly code with the output variable, and one to separate the output variable from the input variables. It's something like asm ("assembly" : <output> : <inputs> : [extra attributes]). Look up 'inline assembly' for GCC and you will see some examples.

sybreon
  • 3,128
  • 18
  • 19