Mips & C++

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

Moderators: cheriff, TyRaNiD

Post Reply
PosX100
Posts: 98
Joined: Wed Aug 15, 2007 1:02 am

Mips & C++

Post by PosX100 »

Could someone tell me how to execute mips code within c++ applications?????

Thanks.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

Example using VFPU ASM

Code: Select all

/** Point is to use gcc specific __asm__(//operations);
/* NOTE: volatile is optional when you know when you need it
 */
int someFunc(int arg1, int arg2) {
... 

__asm__ volatile (
	"lv.q	C000, %0\n"	// 16 byte aligned assumed.
	"vdot.t	S010, C000, C000\n"	// squared magnitude of x,y,z 
	"vrsq.s S010, S010\n"	// 1.0f/sqrtf(x*x+y*y+z*z)
	"vscl.q	C000, C000, S010\n"	// vector/=mag
	"sv.q	C000, %0\n"	// save it again
	: "+m" (*plane)
	);

...
}
10011011 00101010 11010111 10001001 10111010
Post Reply