Skip to content

Issue 11 vu0 macro#48

Open
Whoneon wants to merge 6 commits intoran-j:mainfrom
Whoneon:issue-11-vu0-macro
Open

Issue 11 vu0 macro#48
Whoneon wants to merge 6 commits intoran-j:mainfrom
Whoneon:issue-11-vu0-macro

Conversation

@Whoneon
Copy link

@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.
sanitized.reserve(name.size() + 1);

for (char c : name)
{
Copy link
Owner

Choose a reason for hiding this comment

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

we use cpp stander 20 so almost all of thouse changes are wrong.

std::string targetAction;
std::string funcName = getFunctionName(target);
bool isInternalTarget = internalTargets.contains(target);
bool isInternalTarget = internalTargets.find(target) != internalTargets.end();
Copy link
Owner

Choose a reason for hiding this comment

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

like here

"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

const Instruction &inst = instructions[i];

if (internalTargets.contains(inst.address))
if (internalTargets.find(inst.address) != internalTargets.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

const Instruction &delaySlot = instructions[i + 1];

if (internalTargets.contains(delaySlot.address))
if (internalTargets.find(delaySlot.address) != internalTargets.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

switch (vu_func)
uint8_t vu_fhi_flo = (uint8_t)((((inst.raw >> 6) & 0x1F) << 2) | (inst.raw & 0x3));

// Special2: fhi_flo field (see RabbitizerInstructionR5900.h)
Copy link
Owner

Choose a reason for hiding this comment

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

I think you can remove this

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
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

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.

3 participants