<div dir="ltr">On 31 October 2013 18:57, Matt Turner <span dir="ltr"><<a href="mailto:mattst88@gmail.com" target="_blank">mattst88@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Before this patch, the following code would not be optimized even though<br>
the first two instructions were common to the then and else blocks:<br>
<br>
   (+f0) IF<br>
   MOV dst0 ...<br>
   MOV dst1 ...<br>
   MOV dst2 ...<br>
   ELSE<br>
   MOV dst0 ...<br>
   MOV dst1 ...<br>
   MOV dst3 ...<br>
   ENDIF<br>
<br>
This commit extends the peephole to handle this case.<br>
<br>
No shader-db changes.<br>
---<br>
This patch made a much bigger difference when pulling instructions from the<br>
ends of the "then" and "else" blocks, because often we were able to compute<br>
to MRF.<br></blockquote><div><br></div><div>This patch is:<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br><br>I'd be just as happy if you wanted to squash patches 3 and 4 together into a single patch.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
 src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp | 5 ++---<br>
 1 file changed, 2 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp<br>
index 9626751..c875487 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp<br>
@@ -142,7 +142,6 @@ fs_visitor::opt_peephole_sel()<br>
<br>
       fs_inst *else_mov[MAX_MOVS] = { NULL };<br>
       fs_inst *then_mov[MAX_MOVS] = { NULL };<br>
-      bool malformed_mov_found = false;<br>
<br>
       int movs = count_movs_from_if(then_mov, else_mov, if_inst, else_inst);<br>
<br>
@@ -161,7 +160,7 @@ fs_visitor::opt_peephole_sel()<br>
          if (!then_mov[i]->dst.equals(else_mov[i]->dst) ||<br>
              then_mov[i]->is_partial_write() ||<br>
              else_mov[i]->is_partial_write()) {<br>
-            malformed_mov_found = true;<br>
+            movs = i;<br>
             break;<br>
          }<br>
<br>
@@ -188,7 +187,7 @@ fs_visitor::opt_peephole_sel()<br>
          }<br>
       }<br>
<br>
-      if (malformed_mov_found)<br>
+      if (movs == 0)<br>
          continue;<br>
<br>
       /* Emit a CMP if our IF used the embedded comparison */<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.2<br>
<br>
</font></span></blockquote></div><br></div></div>