vyre-conform 0.1.0

Conformance suite for vyre backends — proves byte-identical output to CPU reference
Documentation
use crate::generate::generators::{pair_bytes, sig, u32_bytes, InputGenerator};
use crate::spec::types::OpSignature;

fn binary_pathological() -> Vec<(String, Vec<u8>)> {
    let mut out = Vec::new();

    // Shift boundaries — the #1 GPU/CPU divergence vector
    for shift in [0, 1, 15, 16, 30, 31, 32, 33, 63, u32::MAX] {
        out.push((
            format!("patho:shift:{shift}"),
            pair_bytes(0xDEAD_BEEF, shift),
        ));
        out.push((format!("patho:shift_one:{shift}"), pair_bytes(1, shift)));
        out.push((
            format!("patho:shift_max:{shift}"),
            pair_bytes(u32::MAX, shift),
        ));
    }

    // Division/modulo edge cases
    for divisor in [0, 1, 2, 3, 7, 16, 256, u32::MAX] {
        out.push((format!("patho:div_by:{divisor}"), pair_bytes(100, divisor)));
        out.push((
            format!("patho:div_max_by:{divisor}"),
            pair_bytes(u32::MAX, divisor),
        ));
        out.push((
            format!("patho:div_zero_by:{divisor}"),
            pair_bytes(0, divisor),
        ));
    }

    // Arithmetic overflow
    out.push(("patho:add_overflow".to_string(), pair_bytes(u32::MAX, 1)));
    out.push((
        "patho:add_overflow2".to_string(),
        pair_bytes(u32::MAX, u32::MAX),
    ));
    out.push(("patho:sub_underflow".to_string(), pair_bytes(0, 1)));
    out.push(("patho:sub_underflow2".to_string(), pair_bytes(0, u32::MAX)));
    out.push((
        "patho:mul_overflow".to_string(),
        pair_bytes(u32::MAX, u32::MAX),
    ));
    out.push((
        "patho:mul_overflow2".to_string(),
        pair_bytes(0x10000, 0x10000),
    ));
    out.push(("patho:mul_by_zero".to_string(), pair_bytes(u32::MAX, 0)));

    // Comparison boundary: equal values at extremes
    out.push(("patho:eq_zero".to_string(), pair_bytes(0, 0)));
    out.push(("patho:eq_max".to_string(), pair_bytes(u32::MAX, u32::MAX)));
    out.push((
        "patho:cmp_adjacent".to_string(),
        pair_bytes(u32::MAX - 1, u32::MAX),
    ));

    // Rotation at exact word boundary
    out.push(("patho:rot_0".to_string(), pair_bytes(0xDEAD_BEEF, 0)));
    out.push(("patho:rot_16".to_string(), pair_bytes(0xDEAD_BEEF, 16)));
    out.push(("patho:rot_32".to_string(), pair_bytes(0xDEAD_BEEF, 32)));

    // extractBits / insertBits edge cases (packed format)
    for offset in [0, 1, 16, 31] {
        for count in [0, 1, 16, 31] {
            let packed = offset | (count << 5);
            out.push((
                format!("patho:extract:off{offset}_cnt{count}"),
                pair_bytes(0xDEAD_BEEF, packed),
            ));
        }
    }

    // Clamp boundary cases (packed format: low=lower 16, high=upper 16 | low)
    out.push(("patho:clamp_zero_bounds".to_string(), pair_bytes(50, 0)));
    out.push((
        "patho:clamp_max_bounds".to_string(),
        pair_bytes(50, 0xFFFF_FFFF),
    ));
    out.push(("patho:clamp_at_low".to_string(), pair_bytes(0, 0x0005_0003)));
    out.push((
        "patho:clamp_at_high".to_string(),
        pair_bytes(u32::MAX, 0x0005_0003),
    ));

    out
}