[Mesa-dev] [PATCH 03/10] nir: Turn -(b2f(a) + b2f(b)) >= 0 into !(a || b).
Jason Ekstrand
jason at jlekstrand.net
Sat Jan 7 15:32:24 UTC 2017
Uh... This hurts overall... The optimization makes sense but do we have
some justification for the hurt?
On Jan 7, 2017 3:59 AM, "Timothy Arceri" <timothy.arceri at collabora.com>
wrote:
From: Kenneth Graunke <kenneth at whitecape.org>
On BDW:
total instructions in shared programs: 13078708 -> 13078787 (0.00%)
instructions in affected programs: 15926 -> 16005 (0.50%)
helped: 19
HURT: 43
total cycles in shared programs: 256561142 -> 256562762 (0.00%)
cycles in affected programs: 126122 -> 127742 (1.28%)
helped: 21
HURT: 37
v2: Rely on b2f's operands being a well-formed boolean (Connor, Eric).
Fix typo in commit title (Patrick).
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com> [v1]
Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>
---
src/compiler/nir/nir_opt_algebraic.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/compiler/nir/nir_opt_algebraic.py
b/src/compiler/nir/nir_opt_algebraic.py
index 434881f..fa9f3f1 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -150,6 +150,9 @@ optimizations = [
# inot(a)
(('fge', 0.0, ('b2f', a)), ('inot', a)),
+ # -(b2f(a) + b2f(b)) >= 0 becomes !(a || b)
+ (('fge', ('fneg', ('fadd', ('b2f', a), ('b2f', b))), 0.0), ('inot',
('ior', a, b))),
+
# 0.0 < fabs(a)
# fabs(a) > 0.0
# fabs(a) != 0.0 because fabs(a) must be >= 0
--
2.9.3
_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170107/a2bec6fd/attachment.html>
More information about the mesa-dev
mailing list