| 2317 | op: IrUnaryOp::Neg, |
| 2318 | ty: i32_ty.clone(), |
| 2319 | value: IrValue::Integer(7), |
| 2320 | }); |
| 2321 | entry.push_instruction(IrInstruction::Cmp { |
| 2322 | dest: IrRegister::Named("ok".into()), |
| 2323 | op: IrCmpOp::Eq, |
| 2324 | ty: i32_ty, |
| 2325 | lhs: IrValue::Register(IrRegister::Named("neg_val".into())), |
| 2326 | rhs: IrValue::Integer(-7), |
| 2327 | }); |
| 2328 | let program = pass_fail_ir( |
| 2329 | "neg", |
| 2330 | entry, |
| 2331 | IrValue::Register(IrRegister::Named("ok".into())), |
| 2332 | ); |
| 2333 | let (_, outcome, _) = run_ir(&program); |
| 2334 | assert!( |
| 2335 | matches!(outcome, RunOutcome::Halted(0)), |
| 2336 | "neg 7 == -7, got {outcome:?}" |
| 2337 | ); |