<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 18, 2017 at 8:27 AM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>><br><div><div class="m_-5079798393513793070h5"><div class="gmail_extra"><br></div></div></div></div></div></blockquote><div><br></div><div>pushed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div><div class="m_-5079798393513793070h5"><div class="gmail_extra"><div class="gmail_quote">On Jan 18, 2017 3:23 AM, "Elie Tournier" <<a href="mailto:tournier.elie@gmail.com" target="_blank">tournier.elie@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_-5079798393513793070m_3248989991605011575quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Add the following optimisations:<br>
<br>
min(x, -x) = -abs(x)<br>
min(x, -abs(x)) = -abs(x)<br>
min(x, abs(x)) = x<br>
max(x, -abs(x)) = x<br>
max(x, abs(x)) = abs(x)<br>
max(x, -x) = abs(x)<br>
<br>
shader-db:<br>
<br>
total instructions in shared programs: 13067779 -> 13067775 (-0.00%)<br>
instructions in affected programs: 249 -> 245 (-1.61%)<br>
helped: 4<br>
HURT: 0<br>
<br>
total cycles in shared programs: 252054838 -> 252054806 (-0.00%)<br>
cycles in affected programs: 504 -> 472 (-6.35%)<br>
helped: 2<br>
HURT: 0<br>
<br>
Signed-off-by: Elie Tournier <<a href="mailto:tournier.elie@gmail.com" target="_blank">tournier.elie@gmail.com</a>><br>
---<br>
src/compiler/nir/nir_opt_alge<wbr>braic.py | 12 ++++++++++++<br>
1 file changed, 12 insertions(+)<br>
<br>
diff --git a/src/compiler/nir/nir_opt_alg<wbr>ebraic.py b/src/compiler/nir/nir_opt_alg<wbr>ebraic.py<br>
index a557f7bf37..0dfa53fbf4 100644<br>
--- a/src/compiler/nir/nir_opt_alg<wbr>ebraic.py<br>
+++ b/src/compiler/nir/nir_opt_alg<wbr>ebraic.py<br>
@@ -171,6 +171,18 @@ optimizations = [<br>
(('imax', a, a), a),<br>
(('umin', a, a), a),<br>
(('umax', a, a), a),<br>
+ (('fmin', a, ('fneg', a)), ('fneg', ('fabs', a))),<br>
+ (('imin', a, ('ineg', a)), ('ineg', ('iabs', a))),<br>
+ (('fmin', a, ('fneg', ('fabs', a))), ('fneg', ('fabs', a))),<br>
+ (('imin', a, ('ineg', ('iabs', a))), ('ineg', ('iabs', a))),<br>
+ (('fmin', a, ('fabs', a)), a),<br>
+ (('imin', a, ('iabs', a)), a),<br>
+ (('fmax', a, ('fneg', ('fabs', a))), a),<br>
+ (('imax', a, ('ineg', ('iabs', a))), a),<br>
+ (('fmax', a, ('fabs', a)), ('fabs', a)),<br>
+ (('imax', a, ('iabs', a)), ('iabs', a)),<br>
+ (('fmax', a, ('fneg', a)), ('fabs', a)),<br>
+ (('imax', a, ('ineg', a)), ('iabs', a)),<br>
(('~fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'),<br>
(('~fmax', ('fmin', a, 1.0), 0.0), ('fsat', a), '!options->lower_fsat'),<br>
(('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'),<br>
<font color="#888888">--<br>
2.11.0<br>
<br>
</font></blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div>