i965/fs: Swap if/else conditions in SEL peephole.
authorMatt Turner <mattst88@gmail.com>
Tue, 11 Feb 2014 21:04:55 +0000 (13:04 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 24 Jul 2014 18:27:44 +0000 (11:27 -0700)
Will clarify make the next commit easier to read.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp

index cf47cb5fd81520b9b2d9d823baf228eb23123a86..c0bba8e7ced553f18332b9bba0ea43d323683caa 100644 (file)
@@ -175,7 +175,9 @@ fs_visitor::opt_peephole_sel()
             break;
          }
 
-         if (!then_mov[i]->src[0].equals(else_mov[i]->src[0])) {
+         if (then_mov[i]->src[0].equals(else_mov[i]->src[0])) {
+            sel_inst[i] = MOV(then_mov[i]->dst, then_mov[i]->src[0]);
+         } else {
             /* 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
              * temporary.
@@ -197,8 +199,6 @@ fs_visitor::opt_peephole_sel()
                sel_inst[i]->predicate = if_inst->predicate;
                sel_inst[i]->predicate_inverse = if_inst->predicate_inverse;
             }
-         } else {
-            sel_inst[i] = MOV(then_mov[i]->dst, then_mov[i]->src[0]);
          }
       }