to compile to this asm:Code :Output.Position = saturate((input.Position * -input.Position) + abs(input.Position));
Code :mad_sat o0.xyzw, v0.xyzw, -v0.xyzw, |v0.xyzw|
I'm not sure I've seen any instruction set that lets you have saturates on input though, abs and neg sure, but sat and ssat only seem to be allowed on output.
I certainly agree with you that the Mesa guys don't really know how to do compilers. They seem to do a lot of their optimizations on the GLSL tree IR, which is just awkward. The TGSI instruction set it's mean to get compiled to doesn't support things like predicates, or updating condition codes on any instruction. The fact that they have 3 IRs (Mesa, GLSL and TGSI) make things even more confusing.