The OpenGL standard guarantees that at least 256 distinct values are preserved when writing to an 8-bit framebuffer. I’m pretty sure Cg does the same.
So you should be able to write your two values in this way:
output.a = (4.0 * clamp(val1, 0.0, 63.0)
+ clamp(val2, 0.0, 3.0)) / 255.0;
And retrieve them like this:
float val1 = floor(input.a * 255.0 / 4.0);
float val2 = fmod(input.a * 255.0, 4.0);
This is equivalent to bitwise operations on integers.