<div dir="ltr"><div>Nevermind. Patch 2 answers that question in the commit message.<br><br></div>--Aaron<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 6, 2015 at 10:25 AM, Aaron Watry <span dir="ltr"><<a href="mailto:awatry@gmail.com" target="_blank">awatry@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Aug 6, 2015 at 6:36 AM, Thomas Helland <span dir="ltr"><<a href="mailto:thomashelland90@gmail.com" target="_blank">thomashelland90@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-NaN != NaN, and -Inf != Inf, so this should be safe.<br></blockquote><div><br></div></span><div>What about -0.0 ?  Does feq/fne treat both negative and positive zero as equivalent?<span class="HOEnZb"><font color="#888888"><br><br></font></span></div><span class="HOEnZb"><font color="#888888"><div>--Aaron<br></div></font></span><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Found while working on my VRP pass.<br>
<br>
Shader-db results on my IVB:<br>
total instructions in shared programs: 1698267 -> 1698067 (-0.01%)<br>
instructions in affected programs:     15785 -> 15585 (-1.27%)<br>
helped:                                36<br>
HURT:                                  0<br>
GAINED:                                0<br>
LOST:                                  0<br>
<br>
Some shaders was found to have the following pattern in NIR:<br>
vec1 ssa_26 = fneg ssa_21<br>
vec1 ssa_27 = fne ssa_21, ssa_26<br>
<br>
Make that:<br>
vec1 ssa_27 = fne ssa_21, 0.0f<br>
<br>
This is found in Dota2 and Brutal Legend.<br>
One shader is cut by 8%, from 323 -> 296 instructons in SIMD8<br>
<br>
Signed-off-by: Thomas Helland <<a href="mailto:thomashelland90@gmail.com" target="_blank">thomashelland90@gmail.com</a>><br>
---<br>
 src/glsl/nir/nir_opt_algebraic.py | 1 +<br>
 1 file changed, 1 insertion(+)<br>
<br>
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py<br>
index 3068445..471191b 100644<br>
--- a/src/glsl/nir/nir_opt_algebraic.py<br>
+++ b/src/glsl/nir/nir_opt_algebraic.py<br>
@@ -113,6 +113,7 @@ optimizations = [<br>
    (('sge', a, b), ('b2f', ('fge', a, b)), 'options->lower_scmp'),<br>
    (('seq', a, b), ('b2f', ('feq', a, b)), 'options->lower_scmp'),<br>
    (('sne', a, b), ('b2f', ('fne', a, b)), 'options->lower_scmp'),<br>
+   (('fne', ('fneg', a), a), ('fne', a, 0.0)),<br>
    # Emulating booleans<br>
    (('imul', ('b2i', a), ('b2i', b)), ('b2i', ('iand', a, b))),<br>
    (('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))),<br>
<span><font color="#888888">--<br>
2.5.0<br>
<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" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>