| 2255 | op: IrMathOp::Shr, |
| 2256 | ty: i32_ty.clone(), |
| 2257 | lhs: IrValue::Integer(-8), |
| 2258 | rhs: IrValue::Integer(2), |
| 2259 | }); |
| 2260 | entry.push_instruction(IrInstruction::Cmp { |
| 2261 | dest: IrRegister::Named("ok".into()), |
| 2262 | op: IrCmpOp::Eq, |
| 2263 | ty: i32_ty, |
| 2264 | lhs: IrValue::Register(IrRegister::Named("shifted".into())), |
| 2265 | rhs: IrValue::Integer(-2), |
| 2266 | }); |
| 2267 | let program = pass_fail_ir( |
| 2268 | "shr_signed", |
| 2269 | entry, |
| 2270 | IrValue::Register(IrRegister::Named("ok".into())), |
| 2271 | ); |
| 2272 | let (_, outcome, _) = run_ir(&program); |
| 2273 | assert!( |
| 2274 | matches!(outcome, RunOutcome::Halted(0)), |
| 2275 | "sra: -8 >> 2 == -2, got {outcome:?}" |
| 2276 | ); |
| 2277 | } |
| 2278 | |