forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

VFPU: problem with vtfm3.t

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
davidgf



Joined: 31 Aug 2009
Posts: 22

PostPosted: Sun Sep 27, 2009 4:25 am    Post subject: VFPU: problem with vtfm3.t Reply with quote

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

Code:

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:


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]));
}
Back to top
View user's profile Send private message
jsharrad



Joined: 20 Oct 2005
Posts: 102

PostPosted: Mon Sep 28, 2009 12:52 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
davidgf



Joined: 31 Aug 2009
Posts: 22

PostPosted: Mon Sep 28, 2009 7:33 am    Post subject: Reply with quote

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!
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Thu Oct 15, 2009 6:06 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Thu Oct 15, 2009 6:24 am    Post subject: Reply with quote

can you be more precise about what you get with vtfm3.t ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group