MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / parse_jal

Function parse_jal

crates/asm-to-binary/src/assembler/parser.rs:512–531  ·  view source on GitHub ↗

Parse `rd, label` (or just `label` for the `j` form handled above).

(operands: &str)

Source from the content-addressed store, hash-verified

510 return out;
511 }
512
513 if (-2_147_483_648..=2_147_483_647).contains(&imm) {
514 load32(rd, imm as i32, &mut out);
515 return out;
516 }
517
518 // 64-bit: split into high32 and low32, combine with shifts.
519 // Uses t1 (x6) as a temporary for the high half.
520 const T1: u8 = 6;
521 let low32 = (imm & 0xFFFF_FFFF) as i32;
522 let high32 = ((imm >> 32) & 0xFFFF_FFFF) as i32;
523
524 load32(T1, high32, &mut out);
525 out.push(AsmToken::Real(RealInstruction::Slli(Slli::new(T1, T1, 32))));
526 load32(rd, low32, &mut out);
527 // Zero-extend low32 into rd (clear sign-extension from load32).
528 out.push(AsmToken::Real(RealInstruction::Slli(Slli::new(rd, rd, 32))));
529 out.push(AsmToken::Real(RealInstruction::Srli(Srli::new(rd, rd, 32))));
530 out.push(AsmToken::Real(RealInstruction::Or(Or::new(rd, rd, T1))));
531
532 out
533}
534

Callers

nothing calls this directly

Calls 2

parse_int_regFunction · 0.85
collectMethod · 0.80

Tested by

no test coverage detected