nir/algebraic: sign(x)*x*x is abs(x)*x
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 10 Sep 2018 17:39:42 +0000 (10:39 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 9 Oct 2018 20:56:42 +0000 (13:56 -0700)
commit1546204cdd45476a2cc4ff4adcc742505366398f
tree0e89e92c8fe2ab0d5076c5d2ec4c514811cf54f5
parent10f4a8871ec694b9d2835d670dfc1436736c23d2
nir/algebraic: sign(x)*x*x is abs(x)*x

shader-db results:

All Gen7+ platforms had similar results. (Skylake shown)
total instructions in shared programs: 15106023 -> 15105981 (<.01%)
instructions in affected programs: 300 -> 258 (-14.00%)
helped: 6
HURT: 0
helped stats (abs) min: 7 max: 7 x̄: 7.00 x̃: 7
helped stats (rel) min: 14.00% max: 14.00% x̄: 14.00% x̃: 14.00%
95% mean confidence interval for instructions value: -7.00 -7.00
95% mean confidence interval for instructions %-change: -14.00% -14.00%
Instructions are helped.

total cycles in shared programs: 566050327 -> 566050075 (<.01%)
cycles in affected programs: 2826 -> 2574 (-8.92%)
helped: 6
HURT: 0
helped stats (abs) min: 40 max: 44 x̄: 42.00 x̃: 42
helped stats (rel) min: 8.89% max: 8.94% x̄: 8.92% x̃: 8.92%
95% mean confidence interval for cycles value: -44.30 -39.70
95% mean confidence interval for cycles %-change: -8.95% -8.88%
Cycles are helped.

No changes on Gen6 or earlier.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
src/compiler/nir/nir_opt_algebraic.py