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

Function float_f32_comparison

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

Source from the content-addressed store, hash-verified

2376 let program = pass_fail_ir(
2377 "slt",
2378 entry,
2379 IrValue::Register(IrRegister::Named("ok".into())),
2380 );
2381 let (_, outcome, _) = run_ir(&program);
2382 assert!(
2383 matches!(outcome, RunOutcome::Halted(0)),
2384 "slt: -1 < 0 should be true, got {outcome:?}"
2385 );
2386}
2387
2388// --- Floating-point lowering ---
2389// Each program truncates a float result to an i32 exit code with `as`, so a
2390// wrong constant, a non-FPU op, or a bad fcvt shows up as a wrong exit code.
2391
2392#[test]
2393fn float_f32_constant_and_add() {
2394 // Before the fix, `1.5: f32` materialized 0.0 (wrong low 32 bits), so the
2395 // sum was 0. Correct: 1.5 + 2.5 = 4.0 -> 4.
2396 let (_, outcome, _) = run_hll(
2397 r#"
2398main: () -> i32 {
2399 a: f32 = 1.5

Callers

nothing calls this directly

Calls 1

run_hllFunction · 0.70

Tested by

no test coverage detected