vyre-reference 0.4.1

Pure-Rust CPU reference interpreter for vyre IR — byte-identical oracle for backend conformance and small-data fallback
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use crate::{dual_impls::common, workgroup::Memory};
use vyre_primitives::ShiftLeft;

impl common::ReferenceEvaluator for ShiftLeft {
    fn evaluate(&self, inputs: &[Memory]) -> Result<Memory, common::EvalError> {
        let (left, right) = common::two_inputs(inputs, "shift_left")?;
        let shift = common::read_u32(right, "shift_left")? & 31;
        Ok(common::scalar(
            common::read_u32(left, "shift_left")? << shift,
        ))
    }
}