Parse `rd, csr, rs1` for the full CSR read-modify-write instructions.
(mnemonic: &str, operands: &str)
| 617 | }) |
| 618 | } |
| 619 | |
| 620 | // Parse `rs, label` for a zero-register branch (`beqz`/`bnez`). |
| 621 | // Expands to `beq/bne rs, x0, label`. |
| 622 | fn parse_branch_zero(kind: BranchKind, operands: &str) -> Option<AsmToken> { |
| 623 | let comma = operands.find(',')?; |
| 624 | let rs1 = parse_int_reg(operands[..comma].trim())?; |
| 625 | let target = operands[comma + 1..].trim().to_owned(); |
| 626 | if target.is_empty() { |
| 627 | return None; |
| 628 | } |
| 629 | Some(AsmToken::Branch { |
| 630 | kind, |
| 631 | rs1, |
| 632 | rs2: 0, |
| 633 | target, |
| 634 | }) |
| 635 | } |
| 636 | |
| 637 | // Map a CSR name or numeric literal to its 12-bit address. |
no test coverage detected