i965/fs: do SEL optimization only when src type for MOV matches
authorTapani Pälli <tapani.palli@intel.com>
Tue, 7 Jan 2014 08:25:40 +0000 (10:25 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Wed, 8 Jan 2014 05:06:45 +0000 (07:06 +0200)
Fixes a bug where then branch operates with ivec4 while else uses vec4.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=72379

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp

index d314799802812d568faf49c5c5e0f94267a9509c..db0be1911cc439905406398580f21a97d7695a36 100644 (file)
@@ -169,6 +169,12 @@ fs_visitor::opt_peephole_sel()
             break;
          }
 
+         /* Check that source types for mov operations match. */
+         if (then_mov[i]->src[0].type != else_mov[i]->src[0].type) {
+            movs = i;
+            break;
+         }
+
          if (!then_mov[i]->src[0].equals(else_mov[i]->src[0])) {
             /* Only the last source register can be a constant, so if the MOV
              * in the "then" clause uses a constant, we need to put it in a