summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_algebraic.py
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2016-06-27 11:38:15 -0700
committerIan Romanick <ian.d.romanick@intel.com>2016-07-19 12:19:30 -0700
commit0b626d75241213f2c5535b38aee233d6cdbed781 (patch)
tree554f7a39c9e44232b357302404c6c5449c1bd867 /src/compiler/nir/nir_opt_algebraic.py
parent94296be276bf9c0a574df262b5d45f1bf38918ff (diff)
downloadexternal_mesa3d-0b626d75241213f2c5535b38aee233d6cdbed781.zip
external_mesa3d-0b626d75241213f2c5535b38aee233d6cdbed781.tar.gz
external_mesa3d-0b626d75241213f2c5535b38aee233d6cdbed781.tar.bz2
nir/algebraic: Optimize fabs(u2f(x))
I noticed this when I tried to do frexp(float(some_unsigned)) in the ir_unop_find_lsb lowering pass. The code generated for frexp() uses fabs, and this resulted in an extra instruction. Ultimately I ended up not using frexp. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/compiler/nir/nir_opt_algebraic.py')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 7d04ef9..0f0896b 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -75,6 +75,7 @@ optimizations = [
(('ineg', ('ineg', a)), a),
(('fabs', ('fabs', a)), ('fabs', a)),
(('fabs', ('fneg', a)), ('fabs', a)),
+ (('fabs', ('u2f', a)), ('u2f', a)),
(('iabs', ('iabs', a)), ('iabs', a)),
(('iabs', ('ineg', a)), ('iabs', a)),
(('~fadd', a, 0.0), a),