[review] mstan #272 - recompiler: sync GTE read-helper classification with runtime accessor semantics - #6
Closed
Alexbeav wants to merge 1 commit into
Conversation
… semantics The emitter's mfc2/cfc2 raw-vs-helper classification (gte_register_classification.h) was out of sync with the runtime's gte_read_data/gte_read_ctrl special cases: compiled code read OTZ(7) and SZ0-3(16-19) unmasked and VZ/IR-class regs (1,3,5,8-11) without sign extension, and cfc2 missed ctrl regs 4/12/20 — while the interpreter always goes through the accessors. Nine data regs + three ctrl regs of backend semantic divergence, locked in by a stale static_assert mask. data_read_needs_helper now covers every gte_read_data special case (masks 0xB08F8FAA data / 0xEC101010 ctrl); regenerate titles to pick it up.
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="recompiler/include/gte_register_classification.h">
<violation number="1" location="recompiler/include/gte_register_classification.h:12">
P3: The new comments describe unsigned masked registers as sign-extended, which misstates the accessor contract. Rewrite both comments to distinguish zero-extension from sign-extension.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| @@ -8,7 +8,12 @@ | |||
| namespace PSXRecompGTERegisters { | |||
There was a problem hiding this comment.
P3: The new comments describe unsigned masked registers as sign-extended, which misstates the accessor contract. Rewrite both comments to distinguish zero-extension from sign-extension.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At recompiler/include/gte_register_classification.h, line 12:
<comment>The new comments describe unsigned masked registers as sign-extended, which misstates the accessor contract. Rewrite both comments to distinguish zero-extension from sign-extension.</comment>
<file context>
@@ -8,7 +8,12 @@
constexpr bool data_read_needs_helper(uint8_t reg) {
- return (reg >= 8 && reg <= 11) || reg == 15 || reg == 23 ||
+ /* Must cover every reg gte_read_data() treats specially (gte.cpp):
+ * 1,3,5,8-11 sign-extend; 7,16-19 mask to 16 bits; 15 mirrors 14;
+ * 28/29 pack IRGB; 31 computes LZCR. 23 kept from the legacy set. */
+ return reg == 1 || reg == 3 || reg == 5 || reg == 7 ||
</file context>
Owner
Author
|
Review complete. The corresponding upstream PR was merged: mstan#272 Closing this fork review without merge. Its immutable base, discussion, and commit history remain available as evidence. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This is a review-only retrofit for the already-open upstream PR mstan/psxrecomp#272.
Do not merge this PR. The AI reviewer must inspect this exact diff before the next upstream update.
Identity
47bda8172e43fdba1879c1a5885904a265c567f662dc9b9bb4b72bbacedada5736d783bd331e0784pr/gte-read-classificationReview gate
Classify each finding as valid, invalid, or uncertain. A valid finding requires a correction, a regression, and repeated validation. An uncertain finding blocks the next upstream update.
Developed with AI assistance; validated as described (test evidence in PR body). AI writes the code and the PR, but I always test before I send something up. Happy to iterate on this process with your feedback.
Summary by cubic
Fixes the GTE read-helper classification so compiled code applies the same masking and sign-extension as the runtime accessors for data and control register reads.
data_read_needs_helperto cover regs 1, 3, 5, 7, 16-19, andctrl_read_needs_helperto include 4, 12, 20.Review-only PR for upstream
mstan/psxrecomp#272; do not merge.Written for commit 62dc9b9. Summary will update on new commits.