fix(disasm): PPCBUG-640+650 fmt_bc spurious condition suffix on bdnz/bdz
PPCBUG-640: For BO=16 (bdnz: decrement CTR, branch if non-zero, ignore CR)
and BO=18 (bdz: same with branch-if-zero), `fmt_bc` fell through to the
`if decr` block and computed `cond_name_opt` from the don't-care BI=0 /
cond_true=false pair, yielding `Some("ge")`. The output was therefore
`bdnzge` / `bdzge` — a CTR-only branch with a spurious CR-derived suffix.
PPCBUG-650 (companion): the golden fixture pinned the wrong output, so
the regression had no detection signal until now.
`fmt_bclr` already had the correct `if decr && uncond` guard at line 872
producing `bdnzlr` / `bdzlr`. `fmt_bc` lacked the equivalent.
Fix: gate the condition string on `!uncond` inside the `if decr` block.
For BO=16/18 (uncond bit set), the condition suffix is now empty.
Tests: extended_mnemonics.json fixture rows for bdnz/bdz now expect the
correct `ext_mnemonic: "bdnz"` / `"bdz"`.
Impact: every analysis-DB query for `bdnz` loops (common in pixel-shader
and vertex processing) was returning zero rows; matches stored as `bdnzge`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -366,7 +366,7 @@
|
||||
"addr": "0x82000000",
|
||||
"mnemonic": "bc",
|
||||
"operands": "16, lt, 0x82000040",
|
||||
"ext_mnemonic": "bdnzge",
|
||||
"ext_mnemonic": "bdnz",
|
||||
"ext_operands": "0x82000040",
|
||||
"branch_target": "0x82000040"
|
||||
},
|
||||
@@ -376,7 +376,7 @@
|
||||
"addr": "0x82000000",
|
||||
"mnemonic": "bc",
|
||||
"operands": "18, lt, 0x82000040",
|
||||
"ext_mnemonic": "bdzge",
|
||||
"ext_mnemonic": "bdz",
|
||||
"ext_operands": "0x82000040",
|
||||
"branch_target": "0x82000040"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user