| 2276 | ); |
| 2277 | } |
| 2278 | |
| 2279 | /// Left shift (`sll`): 1 << 10 must equal 1024. Built directly in IR. |
| 2280 | #[test] |
| 2281 | fn ir_math_shl() { |
| 2282 | let i32_ty = IrType::Integer(IntWidth::I32); |
| 2283 | let mut entry = IrBlock::new("entry"); |
| 2284 | entry.push_instruction(IrInstruction::Math { |
| 2285 | dest: IrRegister::Named("result".into()), |
| 2286 | op: IrMathOp::Shl, |
| 2287 | ty: i32_ty.clone(), |
| 2288 | lhs: IrValue::Integer(1), |
| 2289 | rhs: IrValue::Integer(10), |
| 2290 | }); |
| 2291 | entry.push_instruction(IrInstruction::Cmp { |
| 2292 | dest: IrRegister::Named("ok".into()), |
| 2293 | op: IrCmpOp::Eq, |
| 2294 | ty: i32_ty, |
| 2295 | lhs: IrValue::Register(IrRegister::Named("result".into())), |
| 2296 | rhs: IrValue::Integer(1024), |
| 2297 | }); |
| 2298 | let program = pass_fail_ir( |
| 2299 | "shl", |