Skip to content

Issue 11 vu0 macro#48

Merged
ran-j merged 8 commits intoran-j:mainfrom
Whoneon:issue-11-vu0-macro
Feb 17, 2026
Merged

Issue 11 vu0 macro#48
ran-j merged 8 commits intoran-j:mainfrom
Whoneon:issue-11-vu0-macro

Conversation

@Whoneon
Copy link
Contributor

@Whoneon Whoneon commented Feb 6, 2026

Summary

This PR introduces several improvements and fixes to the VU0 instruction handling:

Decoding and Instruction Alignment

  • Updated the VU0 Special2 instruction decoding to properly align with the fhi_flo field, matching Rabbitizers implementation for better compatibility

New Features

  • Implemented the VCLIPw instruction with its clip-flag FIFO buffer
  • Added support for the VABS instruction

Bug Fixes

  • Corrected the behavior of field variant instructions (VADDx, VSUBx, VMULx) to properly broadcast the specified component ft[n] across the vector operation
  • Maintained C++17 standard compliance by replacing unordered_set::contains calls in code_generator.cpp with C++17-compatible alternatives -> might consider migrating to C++20 but requires a thorough revision
  • Removed dead code related to an ADDIU return statement
  • Refined metadata handling for the VWAITQ instruction

Important Notes

  • VWAITQ currently operates as a no-op in the runtime model and may require additional validation in future updates
  • The VCLIPw clip flags follow a specific ordering: x-, x+, y-, y+, z-, z+, stored in a 24-bit FIFO buffer

Testing Status: Tests have not been run yet

AntoniogEnergine and others added 3 commits February 5, 2026 12:30
Align Special2 decoding with fhi_flo, implement VCLIPw/VABS, and fix field variants (VADDx/VSUBx/VMULx). Keep C++17 compatibility by replacing unordered_set::contains and remove dead ADDIU return. Update Special2 metadata for VWAITQ.
"SifSetDChain"};

if (systemCallNames.contains(function.name))
if (systemCallNames.find(function.name) != systemCallNames.end())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

inst.modificationInfo.modifiesVFR = false;
inst.modificationInfo.modifiesVIR = true;
}
if (vu_func == VU0_S2_VMFIR)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was remove in favor of line 817 ?

@Whoneon
Copy link
Contributor Author

Whoneon commented Feb 6, 2026

Restored C++20 compatibility

@Whoneon Whoneon requested a review from ran-j February 6, 2026 18:46
@ran-j
Copy link
Owner

ran-j commented Feb 6, 2026

Nice I will take some time to review this, I'm weak with vu instructions

@ran-j
Copy link
Owner

ran-j commented Feb 7, 2026

@xms0g can you help review?

@xms0g
Copy link
Contributor

xms0g commented Feb 8, 2026

@xms0g can you help review?

Not familiar with VU instructions but I'll check it out

@ran-j
Copy link
Owner

ran-j commented Feb 14, 2026

I think you broke the one decoder instruction:
See this test:
[Run]: COP2 VU macro op marks VU flags [Failed]

@Whoneon
Copy link
Contributor Author

Whoneon commented Feb 14, 2026

I think you broke the one decoder instruction: See this test: [Run]: COP2 VU macro op marks VU flags [Failed]

I'll check that in the following days. Thanks for pointing that out!

@Whoneon
Copy link
Contributor Author

Whoneon commented Feb 16, 2026

I think you broke the one decoder instruction: See this test: [Run]: COP2 VU macro op marks VU flags [Failed]

The VDIV test was placing VU0_S2_VDIV (0x38) directly in the func field, but Special2 decoding requires function >= 0x3C. Now it properly encodes fhi/flo bits, so the decoder recognizes it as a Special2 op. Every test (34/34) is now passing. I also added a missing #include <optional> in elf_analyzer.cpp that was blocking the build on ubuntu. It would be useful to think again about including a CI for non-windows environments

@ran-j ran-j merged commit 4961710 into ran-j:main Feb 17, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants