Module: Mesa
Branch: main
Commit: 917d992b320740d548ee0eb442e927c7ac5184fa
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=917d992b320740d548ee0eb442e927c7ac5184fa

Author: Gert Wollny <[email protected]>
Date:   Thu Nov 10 13:06:08 2022 +0100

nir/algeraic_opt: use double options too for lowering ftrunc@64

ftrunc@64 also might need lowering on fp64 only, especially now
that it might be introduced by nir_lower_int64.

Fixes: 29da9856826fa6a4b5117c43c78b4301a49bc6dd
   nir/lower_int64: Enable lowering of 64-bit float to 64-bit integer 
conversions.

Signed-off-by: Gert Wollny <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19657>

---

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

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 026f0ee5558..11deac36ab3 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -368,7 +368,10 @@ optimizations.extend([
    (('~flrp', ('fmul(is_used_once)', a, b), ('fmul(is_used_once)', a, c), d), 
('fmul', ('flrp', b, c, d), a)),
 
    (('~flrp', a, 0.0, c), ('fadd', ('fmul', ('fneg', a), c), a)),
-   (('ftrunc', a), ('bcsel', ('flt', a, 0.0), ('fneg', ('ffloor', ('fabs', 
a))), ('ffloor', ('fabs', a))), 'options->lower_ftrunc'),
+
+   (('ftrunc@16', a), ('bcsel', ('flt', a, 0.0), ('fneg', ('ffloor', ('fabs', 
a))), ('ffloor', ('fabs', a))), 'options->lower_ftrunc'),
+   (('ftrunc@32', a), ('bcsel', ('flt', a, 0.0), ('fneg', ('ffloor', ('fabs', 
a))), ('ffloor', ('fabs', a))), 'options->lower_ftrunc'),
+   (('ftrunc@64', a), ('bcsel', ('flt', a, 0.0), ('fneg', ('ffloor', ('fabs', 
a))), ('ffloor', ('fabs', a))), 'options->lower_ftrunc || 
(options->lower_doubles_options & nir_lower_dtrunc)'),
 
    (('ffloor@16', a), ('fsub', a, ('ffract', a)), 'options->lower_ffloor'),
    (('ffloor@32', a), ('fsub', a, ('ffract', a)), 'options->lower_ffloor'),

Reply via email to