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

Function ir_math_shl

tests/integration/vm_execution.rs:2081–2108  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2079 }
2080 return 1
2081}
2082"#,
2083 );
2084 assert!(
2085 matches!(outcome, StepOutcome::Halted(0)),
2086 "mixed struct: small=7 big=0x8010_0000, got {outcome:?}"
2087 );
2088}
2089
2090// --- IR instruction lowering (merged from ir_instruction_exec.rs) ---
2091// HLL programs cover ops the language expresses directly; directly-constructed
2092// IR covers ops with no HLL surface syntax (signed shift, etc.).
2093
2094/// Signed integer division with a negative dividend must use `div` (signed).
2095#[test]
2096fn ir_math_signed_div() {
2097 let (_, outcome, _) = run_hll(
2098 r#"
2099main: () -> i32 {
2100 result: i32 = -8 / 2
2101 if result == -4 {
2102 return 0
2103 }
2104 return 1
2105}
2106"#,
2107 );
2108 assert!(
2109 matches!(outcome, StepOutcome::Halted(0)),
2110 "signed -8 / 2 should equal -4, got {outcome:?}"
2111 );

Callers

nothing calls this directly

Calls 4

pass_fail_irFunction · 0.85
run_irFunction · 0.85
push_instructionMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected