This patch, based on Matt suggestion, replaces the former two ones, as it gets better results.
Basically, so far opt_vector_float() is only applied when the 4 components of the register are written with MOV. This patch changes the behaviour so it doesn't require to write the 4 components to apply it. Results obtained with shader-db tests are: total instructions in shared programs: 6819484 -> 6811698 (-0.11%) instructions in affected programs: 387245 -> 379459 (-2.01%) total loops in shared programs: 1971 -> 1971 (0.00%) helped: 3980 HURT: 0 GAINED: 3 LOST: 0 Which are better than the ones obtained in the first version. Couple of final comments: * In the original version Matt commented about a bug in opt_dead_code_eliminate(). As he already wrote a patch, I'm just waiting for him to send it. * Matt commented also about a possible improvement in an example that allows evaluating at compile-time. As it is a different optimization, I'm not covering it on this patch, and rather letting it for a future improvement. * I commented about a wrong application of opt_vector_float() in an example Matt found. He told that probably it lacks resetting last_reg to -1. This patch is covering that error. Juan A. Suarez Romero (1): i965: add opportunistic behaviour to opt_vector_float() src/mesa/drivers/dri/i965/brw_vec4.cpp | 60 +++++++++++++++++++++------------- src/mesa/drivers/dri/i965/brw_vec4.h | 3 ++ 2 files changed, 41 insertions(+), 22 deletions(-) -- 2.5.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev