| 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] |
| 2393 | fn 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#" |
| 2398 | main: () -> i32 { |
| 2399 | a: f32 = 1.5 |