i965/fs: Don't perform CSE on inst HW_REG dests (unless it's null)
authorMatt Turner <mattst88@gmail.com>
Thu, 7 Nov 2013 23:09:33 +0000 (15:09 -0800)
committerMatt Turner <mattst88@gmail.com>
Sat, 9 Nov 2013 17:10:24 +0000 (09:10 -0800)
Commit b16b3c87 began performing CSE on CMP instructions with null
destinations. I relaxed the restrictions a bit too much, thereby
allowing CSE to be performed on instructions with, for instance, an
explicit accumulator destination.

This broke the arb_gpu_shader5/fs-imulExtended shader tests because
they emit MUL instructions with the accumulator as the destination. CSE
would instead cause the MUL to write to a GRF, which is lower precision
than the accumulator.

Reviewed-by: Eric Anholt <eric@anholt.net>
Cc: 10.0 <mesa-stable@lists.freedesktop.org>
src/mesa/drivers/dri/i965/brw_fs_cse.cpp

index 47938744cf6e61edadc8b0e1e412b3909e953cc4..27541db9be98ee38bdea2ae9345a8c736736b321 100644 (file)
@@ -129,7 +129,8 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
        inst = (fs_inst *) inst->next) {
 
       /* Skip some cases. */
-      if (is_expression(inst) && !inst->is_partial_write())
+      if (is_expression(inst) && !inst->is_partial_write() &&
+          (inst->dst.file != HW_REG || inst->dst.is_null()))
       {
         bool found = false;