Hi Tom,<br><br>your patch helps but glean/texCube still fails here (it doesn&#39;t fail on master).<br><br>-Marek<br><br><div class="gmail_quote">On Tue, May 11, 2010 at 6:45 PM, Tom Stellard <span dir="ltr">&lt;<a href="mailto:tstellar@gmail.com" target="_blank">tstellar@gmail.com</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I have been testing the peephole optimizer from Nicolai&#39;s r300g-glsl<br>
branch.  There is a bug in it that breaks two of the piglit test cases:<br>
glsl-fs-fragcoord and glsl-orangebook-ch06-bump.  Here is an example of<br>
the bug from glsl-fs-fragcoord:<br>
<br>
0: RCP temp[3].w, input[0].w___;<br>
1: MUL temp[3].xy, input[0].xy__, temp[3].ww__;<br>
2: MAD temp[3].xy, temp[3].xy__, const[3].xy__, const[4].xy__;<br>
3: ADD temp[0].y, const[1]._y__, -temp[3]._y__;<br>
4: RCP temp[1].w, const[2].x___;<br>
5: MUL temp[1].y, temp[3]._x__, temp[1]._w__;<br>
6: MOV temp[1].x, temp[1].y___;<br>
7: RCP temp[2].x, const[2].x___;<br>
8: MUL temp[1].z, temp[0].__y_, temp[2].__x_;<br>
9: MOV temp[1].y, temp[1]._z__;<br>
10: MOV temp[1].z, const[2].__y_;<br>
11: MOV output[0].x, temp[1].x___;<br>
12: MOV output[0].y, temp[1]._y__;<br>
13: MOV output[0].z, temp[1].__z_;<br>
14: MOV output[0].w, const[2].___y;<br>
<br>
In this case the peephole optimizer looks at instruction 6, and then<br>
replace all occurrences of temp[1].x with temp[1].y.  This affects<br>
instruction 11:<br>
11: MOV output[0].x, temp[1].x___; -&gt; 11: MOV output[0].x, temp[1].y___;<br>
<br>
This is a problem because temp[1].y is written to in instruction 9,<br>
so it will no longer have the same value as temp[1].x when instruction<br>
11 is executed.<br>
<br>
I have attached a patch that appears to fix the problem.<br>
In order to apply this patch, you will first need to<br>
cherry-pick commit a5e64199f8359cbff589acc9581b264226c41335 from<br>
git://<a href="http://anongit.freedesktop.org/%7Enh/mesa" target="_blank">anongit.freedesktop.org/~nh/mesa</a> into master.<br>
<br>
With this patch, the peephole optimizer passes all the GLSL<br>
piglit tests that are currently passed by mesa&#39;s master<br>
branch.  Here are the piglit results for master, master +<br>
peephole optimizer, and master + peephole optimizier + patch.<br>
<a href="http://ix.cs.uoregon.edu/%7Etstellar/piglit/peephole/index.html" target="_blank">http://ix.cs.uoregon.edu/~tstellar/piglit/peephole/index.html</a><br>
<font color="#888888"><br>
-Tom<br>
<br>
</font><br>_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
<br></blockquote></div><br>