 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Sun Nov 15, 2009 6:29 am Post subject: Error: unrecognized opcode `lv' |
|
|
Hi there,
I'm using MinPSPW SDK with eclipse and getting the error:
Error: unrecognized opcode `lv' when I try to compile:
| Code: |
float clVfpuTool::distanceVector3(ScePspFVector3 *v1, ScePspFVector3 *v2)
{
float result;
__asm__ volatile (
"lv.t C000, %1\n"
"lv.t C100, %2\n"
"vsub.t C000, C000, C100\n"
"vdot.t S010, C000, C000\n"
"vsqrt.s S010, S010\n"
"sv.s S010, %0\n"
: "=r"(result):"r"(v1),"r"(v2));
return result;
|
Has anyone any Idea ? I've already tried to re-install the pspsdk.
However,
the following code compiles without error:
| Code: |
float clVfpuTool::sinf(float rad)
{
float result;
__asm__ volatile (
"mtv %1, S000\n" //load input to single register
"vcst.s S001, VFPU_2_PI\n" //load constant 2/PI
"vmul.s S000, S000, S001\n" //S000 = S000 * S001
"vsin.s S000, S000\n" //S000 = SIN(S000)
"mfv %0, S000\n" //store register back
: "=r"(result):"r"(rad)
);
return result;
} |
|
|
| Back to top |
|
 |
Criptych
Joined: 12 Sep 2009 Posts: 79
|
Posted: Sun Nov 15, 2009 11:27 pm Post subject: |
|
|
The problem is the ".t" suffix - lv can only take .s or .q. I did this myself a couple times. :) You have to either load the components individually with .s, or load an extra (possibly garbage) value with .q. _________________ PSP-2000 // CFW: 5.50 GEN-D2 ...and not upgrading until OFW supports homebrew!
(But I did downgrade to 1.50 with TimeMachine...)
"I want you to tell me how the machine makes you feel." |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Mon Nov 16, 2009 3:41 am Post subject: |
|
|
if you don't care about compatibility with PSP1K (fat/phat/tank), you can use "ulv.q" to load your vectors and just compute with .t. Normally the fourth component of a vector is not changed by the computation so you can store it through "usv.q". But in your example, a "sv.s" is perfect :).
if you care about compatibility with PSP1K, you have no choice else to use three "lv.s" and three "sv.s". |
|
| Back to top |
|
 |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Mon Nov 16, 2009 4:33 am Post subject: |
|
|
Hi,
using "lv.q" results in:
"Macro lv.q not implemented yet"
Therefore I need to use lv.s 3 times.....I've change the code to:
| Code: |
__asm__ volatile (
"lv.s R000, 0 + %1\n"
"lv.s R001, 16 + %1\n"
"lv.s R002, 32 + %1\n"
"lv.s R100, 0 + %2\n"
"lv.s R101, 16 + %2\n"
"lv.s R102, 32 + %2\n"
"vsub.t C000, C000, C100\n"
"vdot.t S010, C000, C000\n"
"vsqrt.s S010, S010\n"
"sv.s S010, %0\n"
: "=r"(result):"r"(v1),"r"(v2));
|
unfortunately I got the following errors:
"Error: Improper VFPU register prefix 'r'"
"Error: expression too complex"
Any further idea ? |
|
| Back to top |
|
 |
Criptych
Joined: 12 Sep 2009 Posts: 79
|
Posted: Mon Nov 16, 2009 1:34 pm Post subject: |
|
|
| anmabagima wrote: | using "lv.q" results in:
"Macro lv.q not implemented yet" |
I've never gotten that error before. :( Are you using an older SDK build?
"r" can be used with mtv and mfv, but for lv/sv you should use "m":
| Code: | | : "=m"(result):"m"(v1),"m"(v2)); |
or
| Code: | "mfv %0, S010\n"
: "=r"(result):"m"(v1),"m"(v2)); |
_________________ PSP-2000 // CFW: 5.50 GEN-D2 ...and not upgrading until OFW supports homebrew!
(But I did downgrade to 1.50 with TimeMachine...)
"I want you to tell me how the machine makes you feel." |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Tue Nov 17, 2009 4:37 am Post subject: |
|
|
| Code: |
__asm__ volatile (
"lv.q C000, %1\n"
"lv.q C100, %2\n"
"vsub.t C000, C000, C100\n"
"vdot.t S010, C000, C000\n"
"vsqrt.s S010, S010\n"
"sv.s S010, %0\n"
: "=r"(result):"m"(v1[0]),"m"(v2[0]):"memory"));
|
or
| Code: |
__asm__ volatile (
"lv.s S000, %1\n"
"lv.s S100, %2\n"
"lv.s S001, %3\n"
"lv.s S101, %4\n"
"lv.s S002, %5\n"
"lv.s S102, %6\n"
"vsub.t C000, C000, C100\n"
"vdot.t S010, C000, C000\n"
"vsqrt.s S010, S010\n"
"sv.s S010, %0\n"
: "=r"(result):"m"(v1[0]),"m"(v2[0]),"m"(v1[1]),"m"(v2[1]),"m"(v1[2]),"m"(v2[2]):"memory"));
|
or
| Code: |
__asm__ volatile (
"lv.s S000, 0(%1)\n"
"lv.s S100, 0(%2\n"
"lv.s S001, 4(%1)\n"
"lv.s S101, 4(%2)\n"
"lv.s S002, 8(%1)\n"
"lv.s S102, 8(%2)\n"
"vsub.t C000, C000, C100\n"
"vdot.t S010, C000, C000\n"
"vsqrt.s S010, S010\n"
"sv.s S010, %0\n"
: "=r"(result):"r"(v1),"r"(v2):"memory");
|
|
|
| Back to top |
|
 |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Tue Nov 17, 2009 6:24 am Post subject: |
|
|
Hi,
thanks for thi hints. I'm using the MinPSPW in it's latest release. I'm pretty sure its not the latest SDK version as of SVN.
However, only the following code will pass the compiler without error:
| Code: |
__asm__ volatile (
"mtv %1, S000\n"
"mtv %4, S100\n"
"mtv %2, S001\n"
"mtv %5, S101\n"
"mtv %3, S002\n"
"mtv %6, S102\n"
"vsub.t C000, C000, C100\n"
"vdot.t S010, C000, C000\n"
"vsqrt.s S010, S010\n"
"mfv %0, S010\n"
: "=r"(result):"r"(v1->x), "r"(v1->y), "r"(v1->z),"r"(v2->x), "r"(v2->y), "r"(v2->z):"memory");
|
Meanwhile:
Is there a possability to update my MinPSPW with the updates available via SVN ?
Thanks. |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Wed Nov 18, 2009 6:11 am Post subject: |
|
|
| use heimdal's pspsdk. |
|
| Back to top |
|
 |
Criptych
Joined: 12 Sep 2009 Posts: 79
|
Posted: Wed Nov 18, 2009 1:57 pm Post subject: |
|
|
| anmabagima wrote: | | I'm using the MinPSPW in it's latest release. |
Are you sure? "MinPSPW" has since lost the W, so maybe you're using the last release which still kept it, and not the actual latest release. I was using MinPSP(W) until recently and was able to use lv.q without error.
| anmabagima wrote: | | Is there a possability to update my MinPSPW with the updates available via SVN ? |
Yes, if you have Cygwin installed... which kind of defeats the purpose. :) _________________ PSP-2000 // CFW: 5.50 GEN-D2 ...and not upgrading until OFW supports homebrew!
(But I did downgrade to 1.50 with TimeMachine...)
"I want you to tell me how the machine makes you feel." |
|
| Back to top |
|
 |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Wed Nov 18, 2009 5:48 pm Post subject: |
|
|
Hi there,
I'm using MinPsP(w) version 0.9.5 I guess this is the latest one. However, I would try to lokate heimdall's and give him a try.
EDIT: After research in the net I come to the conclusion that MinPSP(w) is the one from heimdall ;o) any other Ideas ? Re-Installing havn't solved the issue..
Additional thought: I'm using VFPU within CPP class . May be this isthe root cause? Should VFPU callings only being placed within C code ?
Regards,
AnMaBaGiMa |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Wed Nov 18, 2009 9:18 pm Post subject: |
|
|
your case is weird. C++ or C isn't the issue.
I use Heimdal' pspsdk and never fail with lv.q.
I'm not sure you're using them in gcc correctly |
|
| Back to top |
|
 |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Thu Nov 19, 2009 6:18 am Post subject: |
|
|
| Quote: | | I'm not sure you're using them in gcc correctly |
what do you mean by this ? |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Fri Nov 20, 2009 2:51 am Post subject: |
|
|
| I mean you must post the exact code of your function using "lv.q" which are not working. I'm not sure you are using __asm constraints correctly. |
|
| Back to top |
|
 |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Sun Nov 22, 2009 6:40 am Post subject: |
|
|
Hi there,
I've no clue what happens, but trying again today the following code works now fine:
| Code: | __asm__ volatile (
"lv.q C000, %1\n"
"lv.q C100, %2\n"
"vsub.t C000, C000, C100\n"
"vdot.t S010, C000, C000\n"
"vsqrt.s S010, S010\n"
"mfv %0, S010\n"
: "=r"(result):"m"(*v1),"m"(*v2):"memory"); |
Only issue I've seen that sv.s does not work with a single register like S010.
Using at the end "sv.s S010, %0\n" results in "Error: expression too complex". However, the initial error seem to be fixed. May be I've a selfhealing dev-environment ;o)
Thanks to all for your support
Regards,
AnMaBaGiMa |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Mon Nov 23, 2009 5:09 am Post subject: |
|
|
| Code: | __asm__ volatile (
"lv.q C000, %0\n"
"lv.q C100, %1\n"
"vsub.t C000, C000, C100\n"
"vdot.t S010, C000, C000\n"
"vsqrt.s S010, S010\n"
"sv.s S010, %2\n"
: "m"(*v1),"m"(*v2), "m"(result):"memory"); |
where result is declared as float result;
constraint "r" is only for GPR register, so using "=r" for a base register in sv.s is an error. Maybe using "=m"(result) is possible. |
|
| Back to top |
|
 |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Tue Nov 24, 2009 5:31 am Post subject: |
|
|
Hi,
thanks a lot. This really solved the last issue as well. Great.
You've one free ;)
Regards,
AnMaBaGiMa |
|
| Back to top |
|
 |
|
|
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
|