| 2335 | matches!(outcome, RunOutcome::Halted(0)), |
| 2336 | "neg 7 == -7, got {outcome:?}" |
| 2337 | ); |
| 2338 | } |
| 2339 | |
| 2340 | /// Unsigned less-than comparison via IR: 2 < 5 must be true with `Ult`. |
| 2341 | #[test] |
| 2342 | fn ir_cmp_ult() { |
| 2343 | let i32_ty = IrType::Integer(IntWidth::I32); |
| 2344 | let mut entry = IrBlock::new("entry"); |
| 2345 | entry.push_instruction(IrInstruction::Cmp { |
| 2346 | dest: IrRegister::Named("ok".into()), |
| 2347 | op: IrCmpOp::Ult, |
| 2348 | ty: i32_ty, |
| 2349 | lhs: IrValue::Integer(2), |
| 2350 | rhs: IrValue::Integer(5), |
| 2351 | }); |
| 2352 | let program = pass_fail_ir( |
| 2353 | "ult", |
| 2354 | entry, |
| 2355 | IrValue::Register(IrRegister::Named("ok".into())), |
| 2356 | ); |
| 2357 | let (_, outcome, _) = run_ir(&program); |
| 2358 | assert!( |