Module: Mesa
Branch: master
Commit: 3f779013423b5472e1da939dab1304e9998cfc47
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f779013423b5472e1da939dab1304e9998cfc47

Author: Jesse Natalie <[email protected]>
Date:   Mon Jun 22 08:12:54 2020 -0700

nir: Add an algebraic optimization for float->double->float

As part of this series, it removes the need for float->double conversion,
just to be able to print a single float.

Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254>

---

 src/compiler/nir/nir_opt_algebraic.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 0cd50c38d78..aa55e203ffd 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -1065,6 +1065,10 @@ optimizations.extend([
    (('f2f32', ('i2fmp', 'a@32')), ('i2f32', a)),
    (('f2f32', ('u2fmp', 'a@32')), ('u2f32', a)),
 
+   # Conversions from float32 to float64 and back can be removed as long as
+   # it doesn't need to be precise, since the conversion may e.g. flush denorms
+   (('~f2f32', ('f2f64', 'a@32')), a),
+
    (('ffloor', 'a(is_integral)'), a),
    (('fceil', 'a(is_integral)'), a),
    (('ftrunc', 'a(is_integral)'), a),

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to