rust-psp icon indicating copy to clipboard operation
rust-psp copied to clipboard

Add more vfpu instructions

Open sajattack opened this issue 5 years ago • 11 comments

From http://hlide.free.fr Tracking:

  • [x] mfv
  • [x] mtv
  • [ ] bvf
  • [ ] bvt
  • [ ] bvfl
  • [ ] bvtl
  • [x] vadd
  • [x] vsub
  • [x] vsbn
  • [x] vdiv
  • [x] vmul
  • [x] vdot
  • [x] vscl
  • [x] vhdp
  • [x] vcrs
  • [ ] vcmp
  • [x] vmin
  • [x] vmax
  • [x] vscmp
  • [x] vsge
  • [x] vslt
  • [x] lvs
  • [x] vmov
  • [x] vabs
  • [x] vneg
  • [x] vidt
  • [x] vsat0
  • [x] vsat1
  • [x] vzero
  • [x] vone
  • [x] vrcp
  • [x] vrsq
  • [x] vsin
  • [x] vcos
  • [x] vexp2
  • [x] vlog2
  • [x] vsqrt
  • [x] vasin
  • [x] vnrcp
  • [x] vnsin
  • [x] vrexp2
  • [x] vrnds
  • [x] vrndi
  • [x] vrndf1
  • [x] vrndf2
  • [x] vf2h
  • [x] vh2f
  • [x] vsbz
  • [x] vlgb
  • [x] vuc2i
  • [x] vc2i
  • [x] vus2i
  • [x] vs2i
  • [x] vi2c
  • [x] vi2us
  • [x] vsrt1
  • [x] vsrt2
  • [x] vsrt3
  • [x] vsrt4
  • [x] vbfy1
  • [x] vbfy2
  • [x] vocp
  • [x] vsocp
  • [x] vfad
  • [x] vavg
  • [x] vsrt3
  • [x] vsrt4
  • [ ] vmfvc
  • [ ] vmtvc
  • [x] vt4444
  • [x] vt5551
  • [x] vt5650
  • [x] vcst
  • [x] vf2iz
  • [x] vf2iu
  • [x] vf2id
  • [x] vi2f
  • [ ] vcmovt
  • [ ] vcmovf
  • [ ] vwbn
  • [ ] ulvq
  • [x] lvq
  • [x] vpfxs
  • [x] vpfxt
  • [x] vpfxd
  • [x] viim
  • [ ] vfim
  • [x] svs
  • [ ] usvq
  • [x] lvq

sajattack avatar Jul 16 '20 00:07 sajattack

There is a difference in what we have and what hlide says for vf2in and vi2f.

sajattack avatar Aug 27 '20 00:08 sajattack

I left the remainder for you @overdrivenpotato because I'm not exactly sure how to do their encodings.

sajattack avatar Aug 27 '20 00:08 sajattack

Hi, is the list complete? I'm a little rusty.

hlide avatar Dec 30 '20 17:12 hlide

The list is what was missing when this PR was created, not a complete list, and the ones without checkmarks are what remain. I think it should be complete when all these are done.

sajattack avatar Dec 30 '20 17:12 sajattack

There is a difference in what we have and what hlide says for vf2in and vi2f.

What do you mean?

hlide avatar Dec 30 '20 18:12 hlide

There is a difference in what we have and what hlide says for vf2in and vi2f.

What do you mean?

I don't remember. Looks the same now. Either I fixed it or I was confused.

sajattack avatar Dec 30 '20 18:12 sajattack

Ok, I believe it is the "scale" which is missing in my tables (they are set as 00000).

hlide avatar Dec 30 '20 18:12 hlide

  • bvf bvt bvfl bvtl can be encoded if you know how to pass a label jump as an argument
  • vcmp will set VFPU conditional flags as a result. Since those flags are not touched by the compiler and the normal MIPS instructions, it is almost safe to use it as long as the rest of the code is using those flags inside the same function body.
  • vcmov vcmovf will act according to VFPU conditional flags so if there is a prior VFPU instruction setting those flags in the same function body, it is okay to use them.

I believe MTVC/MFVC are missing. While MTV/MTF allow transferring between scalar VFPU registers and MIPS registers. MTVC/MFVC allow transferring between control VFPU register (like RND or conditional flags registers) and MIPS registers. VMTVC/VMFVC allow transferring between control VFPU register (like RND or conditional flags registers) and scalar VFPU registers.

hlide avatar Dec 30 '20 19:12 hlide

@overdrivenpotato should we close this?

sajattack avatar Jul 11 '22 04:07 sajattack

No, these instructions should definitely still be implemented. I think it's possible to implement them with the current asm!-based trickery, but ultimately if not, we can write a procedural macro.

overdrivenpotato avatar Jul 11 '22 04:07 overdrivenpotato

Yeah, the main question was whether the work done here is transferrable to the new macro or if we need to just redo it.

sajattack avatar Jul 11 '22 04:07 sajattack

superceded by #160

sajattack avatar Jan 07 '24 00:01 sajattack