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: What is wrong ?

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



Joined: 12 Jul 2006
Posts: 160

PostPosted: Fri Jun 15, 2007 6:57 am    Post subject: VFPU: What is wrong ? Reply with quote

I am writing a routines that loads 16 values in the VFPU.
The routine must check if the address in memory in 16-aligned and
if it is not, it must choose automatically the transferring int by int

The code is this:

#define GEN___Load16FloatsToMatrix(_mpTypeFunc_,_mpTag_,_mpNrMatrix_) \
\
\
_mpTypeFunc_ void _mpTag_##Load16FloatsToMatrix_m##_mpNrMatrix_ (float *Data) \
{ \
__asm__ volatile ( \
"and $5, %1, 0x0F\n" \
"bne $5, 0, _LOAD16FLOATSTOMATRIX_NOALLIGN_"#_mpNrMatrix_" \n" \
"lv.q C"#_mpNrMatrix_"00, 0 + %0\n" /* Provvedi a caricare usando il metodo veloce */ \
"lv.q C"#_mpNrMatrix_"10, 16 + %0\n" \
"lv.q C"#_mpNrMatrix_"20, 32 + %0\n" \
"lv.q C"#_mpNrMatrix_"30, 48 + %0\n" \
"b _LOAD16FLOATSTOMATRIX_ENDFUNC_"#_mpNrMatrix_" \n" \
\
"_LOAD16FLOATSTOMATRIX_NOALLIGN_"#_mpNrMatrix_": \n" \
\
"lv.s S"#_mpNrMatrix_"00, 0 + %0\n" /* Provvedi a caricare usando il metodo pił lento */ \
"lv.s S"#_mpNrMatrix_"01, 4 + %0\n" \
"lv.s S"#_mpNrMatrix_"02, 8 + %0\n" \
"lv.s S"#_mpNrMatrix_"03, 12 + %0\n" \
\
"lv.s S"#_mpNrMatrix_"10, 16 + %0\n" \
"lv.s S"#_mpNrMatrix_"11, 20 + %0\n" \
"lv.s S"#_mpNrMatrix_"12, 24 + %0\n" \
"lv.s S"#_mpNrMatrix_"13, 28 + %0\n" \
\
"lv.s S"#_mpNrMatrix_"20, 32 + %0\n" \
"lv.s S"#_mpNrMatrix_"21, 36 + %0\n" \
"lv.s S"#_mpNrMatrix_"22, 40 + %0\n" \
"lv.s S"#_mpNrMatrix_"23, 44 + %0\n" \
\
"lv.s S"#_mpNrMatrix_"30, 48 + %0\n" \
"lv.s S"#_mpNrMatrix_"31, 52 + %0\n" \
"lv.s S"#_mpNrMatrix_"32, 56 + %0\n" \
"lv.s S"#_mpNrMatrix_"33, 60 + %0\n" \
\
"_LOAD16FLOATSTOMATRIX_ENDFUNC_"#_mpNrMatrix_": \n" \
\
: : "m"(*Data), "r"(*Data) : "$5"); \
\
return; \
}

// End macro


MACROGEN1d(inline, Load16FloatsToMatrix, ndEMI_)



The trouble is that CPU hangs. It seems that the method of AND 15
to check if the address in 16 aligned doesn't work.

Where is my error ?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Fri Jun 15, 2007 11:01 am    Post subject: Reply with quote

BNE has a delay slot... you need a nop after it or it'll execute that first lv.q.
Back to top
View user's profile Send private message AIM Address
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