[require]
shader model >= 4.0

[pixel shader]
float4 main() : SV_TARGET
{
    uint x = 5;
    uint y = 15;

    return float4(x + y, x - y, x * y, x / y);
}

[test]
draw quad
probe (0, 0) rgba (20.0, 4294967296.0, 75.0, 0.0)

[pixel shader]
float4 main() : SV_TARGET
{
    uint x = 5;
    uint y = 15;

    return float4(x % y, +x, -x, y / x);
}

[test]
draw quad
probe (0, 0) rgba (5.0, 5.0, 4294967296.0, 3.0)

[pixel shader fail(sm<6)]
float4 main() : SV_TARGET
{
    uint x = 1;
    uint y = 0;

    return x / y;
}

[test]
draw quad
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0)

[pixel shader fail(sm<6)]
float4 main() : SV_TARGET
{
    uint x = 1;
    uint y = 0;

    return x % y;
}

[test]
draw quad
probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0)


% Test expression normalization and simplification.

[pixel shader]
uniform uint4 x;

float4 main() : SV_TARGET
{
    return 6 + (2 * x * 3) - 5;
}

[test]
uniform 0 uint4 0 1 2 3
todo(msl) draw quad
probe (0, 0) rgba (1.0, 7.0, 13.0, 19.0)

% Test collecting terms with constant coefficients.

[pixel shader]
uniform uint x;

float4 main() : SV_TARGET
{
    uint4 res;
    res.x = x * 2 + (3 + 3 * x);
    res.y = (x & 4) | (x & 1);
    res.z = max(min(2, x), min(x, 10));
    res.w = 0;
    return res;
}

[test]
uniform 0 uint 7
todo(msl) draw quad
probe (0, 0) rgba(38.0, 5.0, 7.0, 0.0)