Inline ASM in C/C++ code

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Panajev2001a
Posts: 100
Joined: Sat Aug 20, 2005 3:25 am

Inline ASM in C/C++ code

Post by Panajev2001a »

Is there a reason why code that compiled perfectly on GCC 2.95.2 (PS2Linux... yeah I know some instructions cannot be used on ALLEGREX, etc... it is a question of inline ASM syntax) have to be modified very uglily to even be recognized.

Example:

Original:

Code: Select all

asm __volatile__ ("
.set push
.set noreorder
div.s %0, %1, %2 
mtc1 $0, $f8

...

 
Modified to be recognized...:

Code: Select all

asm __volatile__ (".set\tpush\n\t"
".set\tnoreorder\n\t" 
"div.s\t%0, %1, %2\n\t" 
"mtc1\t$0, $f8\n\t" 

...

It makes writing in-line ASM slower and more annoying. Is there anything that can be done to get gcc/g++ to recognize the original inline ASM syntax ?
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

The PS2 Linux compiler is extremely old. Multiline literals (continuing quotes) were deprecated and obsoleted a long time ago. There's nothing you can do to get psp-gcc to support multiline literals.

BTW you don't need tabs, a space should be fine. You don't need a tab after the newline either.
Post Reply