Closed SK83RJOSH closed 2 months ago
@sajattack this would close #63, and we should create a new issue tracking the missing instructions :)
I would also like to add that there's a possibility of implementing swizzling to all supported instructions, but it would require an additional TT muncher, or an additional macro that supports all combinations of: X
, |X|
, -|X|
I wasn't clever enough to do the muncher, and the latter would be a combinatorial explosion. I figured Saj or Potato might be better at macros though, so if either of you can come up with a clever way to do it I can go ahead and do another round of codegen.
EDIT: You already had a muncher for this, added prefix support to all arguments that support it :)
@overdrivenpotato I think this PR is ready for review, if you'd do me the honors ❤️
@SK83RJOSH VFPU math tests (using vsin and vcos) are failing https://ci.mijalkovic.ca/teams/rust-psp/pipelines/rust-psp/jobs/run-tests-for-pr/builds/409.2 https://github.com/overdrivenpotato/rust-psp/blob/693423a93db19cf63a1eba24b253516cb90e191f/psp/src/math/mod.rs#L61-L99 https://github.com/overdrivenpotato/rust-psp/blob/master/ci/tests/src/math_test.rs
BTW you could use the automated test generator at https://github.com/pspdev/vfpu-docs/ to generate your tests. It would need to be modified to output Rust code, but seems doable to me :) Just my 2c really, I really hate writing tests so I only wrote a small subset of them (the ones that take more time to automate than just manually write).
My plan was to try to write tests for a few instructions of each encoding + each of their flavors; since I think that should be rigorous enough for all codegen but I'll most definitely take a look at that. 🙏
Ironically enough, this entire thing has lead me down another rabbit hole atm, which is getting assertions/stack traces working correctly so I can make the user story for testing a bit less cumbersome... though after a week of plugging away at that I may have to accept what we have 😄
Alrighty, added tests that should hit most if not all of the code gen, with the exception of fixedop
+ imm16
since those are pretty straight forward/are near identical to other instructions. The only thing I have tested here, that I would like to, is matrix operations.
Hold off on merging this until I can validate those, since it would be very unfortunate if gum breaks.
Okey-dokey, I tested the samples + my own project for regressions in gum, only found one so this should be ready to merge. 🙂
I generated most of the missing instructions using a tool I created and have confirmed the accuracy of the code gen via tests I'm writing for a vector math library. Though it would be wise to do a regression test of this commit against the
rust-psp
samples. 🙂This table details the supported instructions, including their encoding/parameter formats for convenience. Anything not supported is likely best to be hand-rolled from this point on.
Instruction Support (99/113)