Module: Mesa
Branch: staging/22.3
Commit: 3fd9b2526f48b7ee77736193bd5e2e73e6df17cb
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3fd9b2526f48b7ee77736193bd5e2e73e6df17cb

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>
(cherry picked from commit 917d992b320740d548ee0eb442e927c7ac5184fa)

---

 .pick_status.json                     | 2 +-
 src/compiler/nir/nir_opt_algebraic.py | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 3900239b2b3..0d63100ef1e 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -409,7 +409,7 @@
         "description": "nir/algeraic_opt: use double options too for lowering 
ftrunc@64",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "29da9856826fa6a4b5117c43c78b4301a49bc6dd"
     },
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