VFPU: problem with vtfm3.t

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

Moderators: cheriff, TyRaNiD

Post Reply
davidgf
Posts: 21
Joined: Mon Aug 31, 2009 10:05 pm

VFPU: problem with vtfm3.t

Post by davidgf »

Hello I have a problem. I'm implementing some functions in VFPU hardware but this function:

Code: Select all

PURE_INLINE void dMULTIPLY0_331_ (dReal* vout, const dReal* mat, const dReal* v) {
	    __asm__ volatile (
	       "ulv.q    R000, 0+  %1\n"

	       "ulv.q    R001, 16+ %1\n"
	       "ulv.q    R002, 32+ %1\n"
	       "ulv.q    R100, %2\n"

	       "vtfm3.t  R003, M000, R100\n"

	       "usv.q    R003, %0\n"
	       : "+m"(vout[0]): "m"(mat[0]), "m"(v[0]));
}
does not work, but this one (which doesn't use vtfm3.t) works like a charm:

Code: Select all


PURE_INLINE void dMULTIPLY0_331_ (dReal* vout, const dReal* mat, const dReal* v) {
	    __asm__ volatile (
	       "ulv.q    R000, 0+  %1\n"

	       "ulv.q    R001, 16+ %1\n"
	       "ulv.q    R002, 32+ %1\n"
	       "ulv.q    R100, %2\n"

	       "vdot.t   S003, R000, R100\n"
	       "vdot.t   S013, R001, R100\n"
	       "vdot.t   S023, R002, R100\n"

	       "usv.q    R003, %0\n"
	       : "+m"(vout[0]): "m"(mat[0]), "m"(v[0]));
}
jsharrad
Posts: 100
Joined: Thu Oct 20, 2005 3:06 am

Post by jsharrad »

I read this a while back...
PLEASE READ THIS: There are 2 instructions, ulv.q and usv.q, that perform unaligned ran transfers to/from the vfpu. These have been found to be faulty so it is not recommended to use them. You have been warned.
davidgf
Posts: 21
Joined: Mon Aug 31, 2009 10:05 pm

Post by davidgf »

I think this has nothing to do with the error.
The error is within the tfm and dot functions. And it's almost impossible to avoid using ulv.q function, because aligning data in the stack is quite complicated!
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

on PSP1000, using ULV wiill scratch FPU register with the same index so if you are using VFPU register $C000 to load it from memory, you're modifying $fpr0 with the same value as $S000 as well. That's why you MUST never use ULV if you plan to keep compatibily with psp1000. The reason is ULV is mapped to MIPS64 LDC1 (FPU double load) and sony engineers probably forgot to cut off the output link to FPU registers.
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

can you be more precise about what you get with vtfm3.t ?
Post Reply