fix(cpu): PPCBUG-040 PPCBUG-560 fix sh64() bit order and rldicl test helper

PPCBUG-040: decoder.rs sh64() assembled the XS-form shift amount as
(SH[4:0] << 1) | SH[5] instead of (SH[5] << 5) | SH[4:0]. Every
`sradi` with shift N ∈ 1..=62 executed with a completely wrong shift
count (e.g. shift=32 executed as shift=1).

PPCBUG-560: disasm_goldens.rs rldicl() test helper was encoding sh[5:1]
at PPC bits 16-20 and sh[0] at PPC bit 30 — exactly backwards. The wrong
encoder and wrong decoder cancelled out, hiding PPCBUG-040 from tests.
Fix both together so tests validate ISA-correct encodings.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-05-01 20:54:40 +02:00
parent ca5b90b700
commit 147daa0721
3 changed files with 33 additions and 10 deletions

View File

@@ -182,7 +182,7 @@
},
{
"label": "srdi r3, r4, 8",
"raw": "0x7883E200",
"raw": "0x7883C202",
"addr": "0x82000000",
"mnemonic": "rldicl",
"operands": "r3, r4, 56, 8",
@@ -191,7 +191,7 @@
},
{
"label": "rotldi r3, r4, 8",
"raw": "0x78832000",
"raw": "0x78834000",
"addr": "0x82000000",
"mnemonic": "rldicl",
"operands": "r3, r4, 8, 0",