<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Dec 22, 2016 at 2:21 PM, Ian Romanick <span dir="ltr"><<a href="mailto:idr@freedesktop.org" target="_blank">idr@freedesktop.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Reviewed-by: Ian Romanick <<a href="mailto:ian.d.romanick@intel.com">ian.d.romanick@intel.com</a>><br>
</blockquote><div><br></div><div>Thanks!<br></div><div>Â </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
On 12/22/2016 01:54 PM, Jason Ekstrand wrote:<br>
> This sequence shows up The Talos Principal, at least under Vulkan,<br>
> and prevents loop analysis from properly computing trip counts in a<br>
> few loops.<br>
> ---<br>
>Â src/compiler/nir/nir_opt_<wbr>algebraic.py | 8 ++++++++<br>
>Â 1 file changed, 8 insertions(+)<br>
><br>
> diff --git a/src/compiler/nir/nir_opt_<wbr>algebraic.py b/src/compiler/nir/nir_opt_<wbr>algebraic.py<br>
> index 698ac67..ff10d70 100644<br>
> --- a/src/compiler/nir/nir_opt_<wbr>algebraic.py<br>
> +++ b/src/compiler/nir/nir_opt_<wbr>algebraic.py<br>
> @@ -464,6 +464,14 @@ def bitfield_reverse(u):<br>
><br>
>Â optimizations += [(bitfield_reverse('x@32'), ('bitfield_reverse', 'x'))]<br>
><br>
> +# For any float comparison operation, "cmp", if you have "a == a && a cmp b"<br>
> +# then the "a == a" is redundant because it's equivalent to "a is not NaN"<br>
> +# and, if a is a NaN then the second comparison will fail anyway.<br>
> +for op in ['flt', 'fge', 'feq']:<br>
> +Â Â optimizations += [<br>
> +Â Â Â (('iand', ('feq', a, a), (op, a, b)), (op, a, b)),<br>
> +Â Â Â (('iand', ('feq', a, a), (op, b, a)), (op, b, a)),<br>
> +Â Â ]<br>
><br>
>Â # Add optimizations to handle the case where the result of a ternary is<br>
> # compared to a constant. This way we can take things like<br>
<br>
</div></div></blockquote></div><br></div></div>