diff --git a/crates/xenia-cpu/src/disasm.rs b/crates/xenia-cpu/src/disasm.rs index 6edbce1..5a98981 100644 --- a/crates/xenia-cpu/src/disasm.rs +++ b/crates/xenia-cpu/src/disasm.rs @@ -828,7 +828,10 @@ fn fmt_bc(instr: &DecodedInstr) -> DisasmText { if decr { let z = if bo & 0x02 != 0 { "z" } else { "nz" }; - let cond_str = cond_name_opt.unwrap_or(""); + // BO bit 4 (uncond) means CR is ignored — pure CTR-decrement branch. + // Without this guard, bdnz/bdz would emit a spurious `ge` suffix derived + // from the don't-care BI=0 / cond_true=false pair (PPCBUG-640). + let cond_str = if uncond { "" } else { cond_name_opt.unwrap_or("") }; let ext_mnem = format!("bd{z}{cond_str}{a}{l}"); let ext_ops = format!("{cr}0x{target:08X}"); with_ext(&base_mnem, base_ops, 8, &ext_mnem, ext_ops, 8) diff --git a/crates/xenia-cpu/tests/golden/extended_mnemonics.json b/crates/xenia-cpu/tests/golden/extended_mnemonics.json index efb251b..6749f94 100644 --- a/crates/xenia-cpu/tests/golden/extended_mnemonics.json +++ b/crates/xenia-cpu/tests/golden/extended_mnemonics.json @@ -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" },