projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bbd60f6
)
nir: Add algebraic optimizations for division and reciprocal.
author
Kenneth Graunke
<kenneth@whitecape.org>
Thu, 22 Jan 2015 07:52:17 +0000
(23:52 -0800)
committer
Kenneth Graunke
<kenneth@whitecape.org>
Fri, 23 Jan 2015 22:53:26 +0000
(14:53 -0800)
These also exist in opt_algebraic.cpp.
total NIR instructions in shared programs:
2011430
->
2011211
(-0.01%)
NIR instructions in affected programs: 42221 -> 42002 (-0.52%)
helped: 198
total i965 instructions in shared programs:
6020553
->
6020116
(-0.01%)
i965 instructions in affected programs: 84322 -> 83885 (-0.52%)
helped: 394
HURT: 1 (by 1 instruction)
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/glsl/nir/nir_opt_algebraic.py
patch
|
blob
|
history
diff --git
a/src/glsl/nir/nir_opt_algebraic.py
b/src/glsl/nir/nir_opt_algebraic.py
index 42846e1202b0b7453f10b0123d6424a25f95d9ce..9c62b2836340e37f2fb9020c98fe71b746ef4fc2 100644
(file)
--- a/
src/glsl/nir/nir_opt_algebraic.py
+++ b/
src/glsl/nir/nir_opt_algebraic.py
@@
-106,6
+106,11
@@
optimizations = [
(('fpow', a, 1.0), a),
(('fpow', a, 2.0), ('fmul', a, a)),
(('fpow', 2.0, a), ('fexp2', a)),
+ # Division and reciprocal
+ (('fdiv', 1.0, a), ('frcp', a)),
+ (('frcp', ('frcp', a)), a),
+ (('frcp', ('fsqrt', a)), ('frsq', a)),
+ (('frcp', ('frsq', a)), ('fsqrt', a)),
# This one may not be exact
(('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),