Welcome, Guest. Please login or register.

Author Topic: Help needed combining GCC/C++ with asm sources  (Read 5743 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Georg

  • Jr. Member
  • **
  • Join Date: Feb 2002
  • Posts: 90
    • Show all replies
Re: Help needed combining GCC/C++ with asm sources
« on: March 26, 2004, 06:19:49 PM »
Quote

Code: [Select]

inline void func(int i, int* j)
{
      asm("move.l %0, d0\n"
          "move.l %0, a0\n"
          "jsr _asmFunction\n"
          :                         // no outputs
          : "g"(i), "g"(j)          // inputs
          : "d0", "d1", "a0", "a1"  // clobbers
      );
}



I would change that to use

Code: [Select]

  : "d0" (i), "a0" (j)


as inputs and leave out the "movel %0,d0" and "movel %0,a0" asm lines. BTW: you can tell the compiler that your asm code changes memory by using "m" in clobbers line. And "cc", to tell it that your code may change condition codes.