Hi, while porting gst-plugins-gl shaders to work with i915 I've passed some time looking at the programs produced by the compiler (with MESA_GLSL=log) and noticed that statements like a += b * c; become MUL C, B, C; ADD A, A, C; while a = b * c + a; becomes MAD A, B, C, A; I don't know how this works in hardware but I guess the latter has a dedicated path and is more efficient or, at least, saves up an instruction (and that's particularly important where the maximum number of instructions is little as in i915). For what is worth, assembly produced by nVidia's Cg uses MAD in both cases. Not sure if this is valid elsewhere too in mesa, tested it with i915 only.
Yeah, this is the sort of thing that the codegen in the new compiler will handle very easily but which is a pain to do in Mesa today.
On the glsl2 branch: commit 3f08989267d9cdd944787fcf7a300c6f1f84462c Author: Eric Anholt <eric@anholt.net> Date: Mon Jul 12 19:28:07 2010 -0700 ir_to_mesa: Emit OPCODE_MAD when we find an ADD of a MUL. Bug #27914.
GLSL2 branch is now merged.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.