This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

M68k Inline Assmbly with C Style Operands


Alex Holland writes:
 > // Example 1: No C style operands  works fine.
 > asm("move  0x2700, %sr");  

Without arguments, gcc passes the string through to the assembler
unchanged.  This is a DIFFERENT kind of asm than an asm with colon
separated arguments.  For example, such an asm is always marked as
"volatile" (IIRC!), and it can be used outside functions.

 > // Example 2: The % in %sr made the compiler look for another operand. 
 > #define MY_MACRO 0x2700
 > 
 > asm("move  %0, %sr;"
 >     : 
 >     : "i"(MY_MACRO)
 > );

s/%sr/%%sr/

 > // Example 3: Would not link because sr is undefined.
 > asm("move  %0, sr;"
 >     : 
 >     : "i"(MY_MACRO)
 > );

I'm guessing %%sr is what you want.

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]