nir/algebraic: Optimize some 64-bit integer comparisons involving zero
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 28 Nov 2019 00:26:03 +0000 (16:26 -0800)
committerMarge Bot <eric+marge@anholt.net>
Thu, 23 Jan 2020 00:18:57 +0000 (00:18 +0000)
commitb065d8fb8cf55373bfdd80994417f1ac60976158
treeda8470b1c420d12537c28ca2fcc93599ff31b661
parentc57338b924710b93193f921cd1e95d6de6b398ef
nir/algebraic: Optimize some 64-bit integer comparisons involving zero

I noticed that we can do better for these kinds of comparisons while
working on the lowering for iadd_sat@64 and isub_sat@64.  This
eliminated 11 instruction from the fs-addSaturate-int64.shader_test.

My hope is that this will improve the run-time of int64 tests on Ice
Lake.  I have no data to support or refute this.

Unsurprisingly, no changes on shader-db.

v2: Condition the min and max patterns with nir_lower_minmax64.
Suggested by Caio.  Very long discussion in the MR. :)

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/767>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/767>
src/compiler/nir/nir_opt_algebraic.py